import request from "@/utils/request";

// ========== 旧版（保留兼容） ==========
export const experienceWallet = (data: any) => {
    return request({ url: "admin/experience-wallet/page-query", method: "post", params: data });
};
export const experienceWalletEvents = (data: any) => {
    return request({ url: "admin/experience-wallet/events", method: "post", params: data });
};
export const experienceWalletMissions = (data: any) => {
    return request({ url: "admin/experience-wallet/missions", method: "post", params: data });
};

// ========== 新版体验金 - 体验金列表 ==========

/** 体验金列表分页查询 */
export const experienceGiftRecordPageQuery = (data: any) =>
    request({ url: "admin/activity/experience-gift/record/page-query", method: "post", params: data });

/** 体验金列表顶部统计 */
export const experienceGiftRecordStats = (params?: any) =>
    request({ url: "admin/activity/experience-gift/record/stats", method: "get", params });

/** 手动回收体验金 */
export const recycleExperienceGift = (id: number | string) =>
    request({ url: `admin/activity/experience-gift/record/recycle/${id}`, method: "post" });

/** 查询体验金来源详情 */
export const getExperienceGiftSource = (id: number | string) =>
    request({ url: `admin/activity/experience-gift/record/source/${id}`, method: "get" });

// ========== 新版体验金 - 体验金提现审核 ==========

/** 提现申请分页列表 */
export const experienceGiftWithdrawPageQuery = (data: any) =>
    request({ url: "admin/activity/experience-gift/withdraw/page-query", method: "post", params: data });

/** 用户体验金钱包详情 */
export const getExperienceGiftMemberInfo = (memberId: number | string) =>
    request({ url: `admin/activity/experience-gift/withdraw/member-info/${memberId}`, method: "get" });

/** 单条审核 */
export const auditExperienceGiftWithdraw = (id: number | string, pass: boolean, remark?: string) =>
    request({ url: `admin/activity/experience-gift/withdraw/audit/${id}`, method: "post", params: { pass, remark } });

/** 批量审核 */
export const batchAuditExperienceGiftWithdraw = (ids: (number | string)[], pass: boolean, remark?: string) =>
    request({ url: "admin/activity/experience-gift/withdraw/batch-audit", method: "post", params: { ids: ids.join(","), pass, remark } });

// ========== 新版体验金 - 体验金产品管理 ==========

/** 产品分页列表 */
export const experienceGiftProductPageQuery = (data: any) =>
    request({ url: "admin/activity/experience-gift/product/page-query", method: "post", params: data });

/** 产品详情（用于编辑回填） */
export const getExperienceGiftProductDetail = (id: number | string) =>
    request({ url: `admin/activity/experience-gift/product/detail/${id}`, method: "get" });

/** 新增 / 修改产品 */
export const saveExperienceGiftProduct = (data: any) =>
    request({ url: "admin/activity/experience-gift/product/save", method: "post", params: data });

/** 启用的手动赠送产品列表（用于赠送下拉框） */
export const listManualExperienceGiftProducts = () =>
    request({ url: "admin/activity/experience-gift/product/list-manual", method: "get" });

// ========== 新版体验金 - 赠送体验金 ==========

/** 手动赠送体验金（批量） */
export const grantExperienceGift = (data: any) =>
    request({ url: "admin/activity/experience-gift/record/grant", method: "post", params: data });

// ========== 新版体验金 - 防刷风控 ==========

/** 防刷预警分页列表 */
export const experienceGiftRiskAlertPageQuery = (data: any) =>
    request({ url: "admin/activity/experience-gift/risk-alert/page-query", method: "post", params: data });

/** 取消单条告警 */
export const cancelExperienceGiftRiskAlert = (id: number | string) =>
    request({ url: `admin/activity/experience-gift/risk-alert/cancel/${id}`, method: "post" });

/** 一键取消所有告警 */
export const cancelAllExperienceGiftRiskAlerts = () =>
    request({ url: "admin/activity/experience-gift/risk-alert/cancel-all", method: "post" });

// ========== 活动落地页配置（ActivityController，type=100） ==========

/** 分页列表（传 type=100 只查落地页） */
export const landingPageQuery = (params?: any) =>
    request({ url: "admin/activity/activity/page-query", method: "post", params });

/** 单条详情（用于编辑回填） */
export const getLandingPageDetail = (id: number | string) =>
    request({ url: `admin/activity/activity/${id}/detail`, method: "get" });

/** 新增 / 修改落地页（save-lp，JSON body，无需密码） */
export const saveLandingPage = (data: any) =>
    request({ url: "admin/activity/activity/save-lp", method: "post", data });
