import request from "@/utils/request"

export function fetchActivities(page, keyword, status) {
  const params = {
    page: page,
    keyword: keyword,
    status: status,
  }
  return request({
    url: '/api/activities',
    method: 'get',
    params: params,
  })
}

export function fetchActivity(id) {
  return request({
    url: "/api/activity",
    method: "get",
    params: {
      id: id,
    }
  })
}

export function submitActivity(publish, activity) {
  return request({
    url: "/api/activity/submit",
    method: "post",
    params: {
      publish: publish,
    },
    data: activity,
  })
}

export function fetchActivityDetailViewData(id) {
  return request({
    url: "/api/activity/detailview",
    method: "get",
    params: {
      id: id,
    }
  })
}

export function fetchActivitySignupUsers(activity_id, keyword, page) {
  return request({
    url: "/api/activity/signups",
    method: "get",
    params: {
      id: activity_id,
      keyword: keyword,
      page: page,
    }
  })
}

export function deleteActivity(activity_id) {
  return request({
    url: "/api/activity/delete",
    method: "post",
    params: {
      id: activity_id,
    }
  })
}

export function publishActivity(activity_id) {
  return request({
    url: "/api/activity/publish",
    method: "post",
    params: {
      id: activity_id,
    }
  })
}

export function getActivityShareInfo(activity_id) {
  return request({
    url: "/api/activity/shareinfo",
    method: "get",
    params: {
      id: activity_id,
    }
  })
}