import { http } from "@/utils/http";

/** 充值记录列表 */
export const getRechargeList = (data?: object) => {
  return http.request<any>("get", "/custom/listRecharge", { params: data });
};

/** 退款记录列表 */
export const getRefundList = (data?: object) => {
  return http.request<any>("get", "/finance/listRefundLog", { params: data });
};

/** 提现记录列表 */
export const getWithdrawList = (data?: object) => {
  return http.request<any>("post", "/finance/withdrawnRecords", { data });
};

/** 分账记录列表 */
export const getSplitRecordList = (data?: object) => {
  return http.request<any>("post", "/finance/splitRecords", { data });
};

/** 结算记录列表 */
export const getSettlementList = (data?: object) => {
  return http.request<any>("post", "/finance/settlementRecords", { data });
};

/** 手动触发结算 */
export const triggerSettlement = () => {
  return http.request<any>("post", "/finance/triggerSettlement");
};

/** 确认结算 */
export const confirmSettlement = (id: number) => {
  return http.request<any>("post", "/finance/confirmSettlement", { data: { id } });
};

/** 用户资金流水列表 */
export const getWalletDetailList = (data?: object) => {
  return http.request<any>("get", "/finance/walletDetails", { params: data });
};

/** 线下充值 */
export const offlineRecharge = (data: {
  userId: number;
  amount: number;
  grantsAmount?: number;
  remark?: string;
}) => {
  return http.request<any>("post", "/finance/offlineRecharge", { data });
};

/** 查询用户（按手机号） */
export const searchUserByPhone = (data: { mobilePhone: string; pageNum: number; pageSize: number }) => {
  return http.request<any>("get", "/custom/listUser", { params: data });
};
