import { tmallabHttp } from '/@/utils/http/axios';

import { ErrorMessageMode } from '/#/axios';

enum Api {
  dictRegionList = '/system/dictRegion/getList',
  addScArea = '/system/scArea/add',
  addScAreaPlatform = '/system/scAreaPlatform/add',
  getScAreaList = '/system/scArea/getList',
  removeScAreaPlatform = '/system/scAreaPlatform/remove',
  getPlatList = '/system/scAreaPlatform/getPlatList',
  getPlatListAll = '/system/plat/list',
}

/**
 * @description: 区域字典-获取省市
 */
export function dictRegionListApi(data: any, mode: ErrorMessageMode = 'message') {
  return tmallabHttp.post<any>(
    {
      url: Api.dictRegionList,
      data,
    },
    {
      errorMessageMode: mode,
    },
  );
}

/**
 * @description: 添加区域
 */
export function addScAreaApi(data: any, mode: ErrorMessageMode = 'message') {
  return tmallabHttp.post<any>(
    {
      url: Api.addScArea,
      data,
    },
    {
      errorMessageMode: mode,
    },
  );
}

/**
 * @description: 管理客户平台-提交
 */
export function addScAreaPlatformApi(data: any, mode: ErrorMessageMode = 'message') {
  return tmallabHttp.post<any>(
    {
      url: Api.addScAreaPlatform,
      data,
    },
    {
      errorMessageMode: mode,
    },
  );
}

/**
 * @description: 区域管理-列表获取
 */
export function getScAreaListApi(data: any, mode: ErrorMessageMode = 'message') {
  return tmallabHttp.post<any>(
    {
      url: Api.getScAreaList,
      data,
    },
    {
      errorMessageMode: mode,
    },
  );
}

/**
 * @description: 管理客户平台-删除平台
 */
export function removeScAreaPlatformApi(data: any, mode: ErrorMessageMode = 'message') {
  return tmallabHttp.post<any>(
    {
      url: Api.removeScAreaPlatform,
      data,
    },
    {
      errorMessageMode: mode,
    },
  );
}
/**
 * @description: 管理客户平台-获取平台列表
 */
export function getPlatListApi(data: any, mode: ErrorMessageMode = 'message') {
  return tmallabHttp.post<any>(
    {
      url: Api.getPlatList,
      data,
    },
    {
      errorMessageMode: mode,
    },
  );
}
/**
 * @description: 管理客户平台-获取所有平台列表
 */
export function getPlatListAllApi(data: any, mode: ErrorMessageMode = 'message') {
  return tmallabHttp.post<any>(
    {
      url: Api.getPlatListAll,
      data,
    },
    {
      errorMessageMode: mode,
    },
  );
}
