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

/** 平台费率列表 */
export const getPlatformRateList = (data?: object) => {
  return http.request<any>("post", "/platform-fee-rate/list", { data });
};

/** 平台费率详情 */
export const getPlatformRateDetail = (id: number) => {
  return http.request<any>("get", `/platform-fee-rate/detail/${id}`);
};

/** 新增平台费率 */
export const addPlatformRate = (data: object) => {
  return http.request<any>("post", "/platform-fee-rate/add", { data });
};

/** 修改平台费率 */
export const updatePlatformRate = (data: object) => {
  return http.request<any>("post", "/platform-fee-rate/modify", { data });
};

/** 删除平台费率 */
export const removePlatformRate = (id: number) => {
  return http.request<any>("get", `/platform-fee-rate/delete/${id}`);
};

// ==================== 充值配置 ====================

/** 充值配置分组列表 */
export const getRechargeConfigGroupList = (params?: object) => {
  return http.request<any>("get", "/rechargeConfig/group/list", { params });
};

/** 新增充值配置分组 */
export const addRechargeConfigGroup = (data: object) => {
  return http.request<any>("post", "/rechargeConfig/group/add", { data });
};

/** 修改充值配置分组 */
export const modifyRechargeConfigGroup = (data: object) => {
  return http.request<any>("post", "/rechargeConfig/group/modify", { data });
};

/** 删除充值配置分组 */
export const removeRechargeConfigGroup = (id: number) => {
  return http.request<any>("get", `/rechargeConfig/group/remove/${id}`);
};

/** 关联站点到分组 */
export const assignStationToGroup = (data: { groupId: number; stationId: string }) => {
  return http.request<any>("post", "/rechargeConfig/group/assignStation", { data });
};

/** 从分组移除站点 */
export const removeStationFromGroup = (data: { groupId: number; stationId: string }) => {
  return http.request<any>("post", "/rechargeConfig/group/removeStation", { data });
};

/** 充值配置项列表 */
export const getRechargeConfigItemList = (params: { groupId: number }) => {
  return http.request<any>("get", "/rechargeConfig/item/list", { params });
};

/** 新增充值配置项 */
export const addRechargeConfigItem = (data: object) => {
  return http.request<any>("post", "/rechargeConfig/item/add", { data });
};

/** 修改充值配置项 */
export const modifyRechargeConfigItem = (data: object) => {
  return http.request<any>("post", "/rechargeConfig/item/modify", { data });
};

/** 删除充值配置项 */
export const removeRechargeConfigItem = (id: number) => {
  return http.request<any>("get", `/rechargeConfig/item/remove/${id}`);
};
