import http from "@/api";
import type { Activity } from "./interface/activity";

// 获取活动详情
export const getActivityDetail = (params: { id: string }) => {
  return http.get<Activity.ActivityFormData>("/store-activity/detail", params);
};

// 保存活动
export const saveActivity = (data: Activity.ActivityFormData) => {
  return http.post<Activity.ActivityFormData>("/store-activity/saveActive", data);
};

// 更新活动
export const updateActivity = (data: Activity.ActivityFormData) => {
  return http.post<Activity.ActivityFormData>("/store-activity/editActive", data);
};

// web端根据关键字获取商家信息
export const getMerchantInfo = (params: { keyword: string }) => {
  return http.get<Activity.ActivityFormData>("/store-activity/getStoreInfoByKeyword", params);
};

// web端根据关键字获取用户端用户信息
export const getUserInfo = (params: { keyword: string }) => {
  return http.get<Activity.ActivityFormData>("/store-activity/getUserInfoByKeyword", params);
};

//web端获取活动列表
export const getActiveList = (params: { keyword: string }) => {
  return http.get<Activity.ActivityFormData>("/store-activity/getActiveList", params);
};

// 审批活动
export const approvalActivities = (params: { id: string; approvalStatus: number; approvalOpinion: string }) => {
  return http.post<Activity.ActivityFormData>("/store-activity/approvalActivities", params);
};
// 创建签到活动
export const createOrUpdateActivity = data => {
  return http.post<Activity.ActivityFormData>("/activity/createOrUpdateActivity", data);
};
// 签到活动列表
export const getActivityConfigList = params => {
  return http.get<Activity.ActivityFormData>("/activity/getActivityConfigList", params);
};
// 签到活动详情
export const getActivitySignInConfigById = params => {
  return http.get<Activity.ActivityFormData>("/activity/getActivitySignInConfigById", params);
};
// 修改活动状态
export const updateActivityStatus = params => {
  return http.get<Activity.ActivityFormData>("/activity/updateActivityStatus", params);
};
//删除活动
export const deleteActivity = params => {
  return http.get<Activity.ActivityFormData>("/activity/deleteActivity", params);
};
// 获取基础活动详情
export const getDefaultActivitySignInConfigById = params => {
  return http.get<Activity.ActivityFormData>("/activity/getDefaultActivitySignInConfigById", params);
};
// 校验活动日期是否重叠
export const checkOverlapTime = params => {
  return http.get<Activity.ActivityFormData>("/activity/checkOverlapTime", params);
};
// 邀请活动列表
export const getInviteActivityConfigList = params => {
  return http.get<Activity.ActivityFormData>("/activityInvite/getInviteActivityConfigList", params);
};
// 创建/编辑邀请活动列表
export const createOrUpdateInviteActivity = params => {
  return http.post<Activity.ActivityFormData>("/activityInvite/createOrUpdateInviteActivity", params);
};
// 获取详情
export const getInviteActivitySignInConfigById = params => {
  return http.get<Activity.ActivityFormData>("/activityInvite/getInviteActivitySignInConfigById", params);
};
// 删除邀请活动列表
export const deleteInviteActivity = params => {
  return http.get<Activity.ActivityFormData>("/activityInvite/deleteInviteActivity", params);
};
// 修改状态--邀请活动
export const updateActivityStatus2 = params => {
  return http.get<Activity.ActivityFormData>("/activityInvite/updateActivityStatus", params);
};
// 返回优惠券列表
export const getPlatformCoupon = params => {
  return http.get<Activity.ActivityFormData>("/life-discount-coupon/getPlatformCoupon", params);
};
// 邀请下载列表
export const getInviteActivityLogList = params => {
  return http.get<Activity.ActivityFormData>("/activityInvite/getInviteActivityLogList", params);
};

//活动管理页面导出excel
export const exportExcel = (params: {}) => {
  return http.get(
    `/store-activity/exportExcel
`,
    params
  );
};
