import { del, get, post, put } from '../../../http'

// 参数类型定义
interface AgentListParams {
  keyword?: string
  page?: number
  size?: number
  status?: string
}

interface AgentChannelParams {
  agentId?: string
  keyword?: string
  page?: number
  size?: number
  status?: string
}

interface CreateAccountRecordParams {
  agentId?: string
  page?: number
  size?: number
  status?: string
}

/**
 * @description: 获取代理商列表
 */
export const getUserAgent = async (params: AgentListParams) => {
  return await get<any>('/userAgent/list', params)
}

/**
 * @description: 新增代理商
 * @param {*} params
 * @return {*}
 */
export const addUserAgent = async (data: Record<string, any>) => {
  return await post<any>('/userAgent', data)
}

/**
 * @description: 获取代理商详情
 * @param {*} id
 * @return {*}
 */
export const getUserAgentDetail = async (id: string) => {
  return await get<any>(`/userAgent/${id}`)
}

/** ----以下是代理商相关接口 以下是代理商相关接口 以下是代理商相关接口 以下是代理商相关接口---- */
/** ----以下是代理商相关接口 以下是代理商相关接口 以下是代理商相关接口 以下是代理商相关接口---- */
/** ----以下是代理商相关接口 以下是代理商相关接口 以下是代理商相关接口 以下是代理商相关接口---- */

/**
 * @description: 获取代理商列表
 */
export const getUserAgentChannel = async (params: AgentChannelParams) => {
  return await get<any>('/userAgentChannel/list', params)
}

/**
 * @description: 代理商新增渠道
 * @param {*} params
 * @return {*}
 */
export const addUserAgentChannel = async (data: Record<string, any>) => {
  return await post<any>('/userAgentChannel', data)
}

/**
 * @description: 代理商修改渠道
 * @param {*} params
 * @return {*}
 */
export const putUserAgentChannel = async (data: Record<string, any>) => {
  return await put('/userAgentChannel', data)
}

/**
 * @description: 代理商删除渠道
 * @param {*} params
 * @return {*}
 */
export const deleteUserAgentChannel = async (id: string) => {
  return await del(`/userAgentChannel/${id}`)
}

/**
 * @description: 获取对应代理商的全部渠道
 * @param {*} params
 * @return {*}
 */
export const getAllChannelByAgentIdApi = async (agentId: string) => {
  return await get(
    `/userAgentCreateAccountRecord/allChannelByAgentId/${agentId}`,
  )
}

/**
 * @description: 获取代理商创建账号记录列表
 */
export const getUserAgentCreateAccountRecord = async (
  params: CreateAccountRecordParams,
) => {
  return await get<any>('/userAgentCreateAccountRecord/list', params)
}

/**
 * @description: 代理商新增账号
 * @param {*} params
 * @return {*}
 */
export const addUserAgentCreateAccountRecord = async (
  data: Record<string, any>,
) => {
  return await post<any>('/userAgentCreateAccountRecord', data)
}

/**
 * @description: 获取总建号数和建号限制
 * @param {*} params
 * @return {*}
 */
export const queryAccountCreateLimit = async (agentId: string) => {
  return await get(
    `/userAgentCreateAccountRecord/queryAccountCreateLimit/${agentId}`,
  )
}

/**
 * @description: 代理商忘记密码
 * @param {*} data
 * @return {*}
 */
export const forgetPwd = async (data: Record<string, any>) => {
  return await post<any>('/userAgentCreateAccountRecord/forgetPwd', data)
}

/**
 * @description: 修改代理商启用状态
 * @param {*} data
 * @return {*}
 */
export const changeAgentUserStatus = async (data: Record<string, any>) => {
  return await post('/userAgentCreateAccountRecord/changeAgentUserStatus', data)
}

/**
 * @description: 代理商-更新
 * @param {*} data
 * @return {*}
 */
export const putUserAgent = async (data: Record<string, any>) => {
  return await put('/userAgent', data)
}

/**
 * @description: 代理商-删除
 * @param {*} data
 * @return {*}
 */
export const deleteUserAgent = async (id: string) => {
  return await del(`/userAgent/${id}`)
}
