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

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

enum Api {
  List = '/authorize/manage/class/list',
  Delete = '/authorize/manage/class/delete',
  Detail = '/authorize/manage/class/detail',
  Update = '/authorize/manage/class/update',
}

/**
 * @description: 接口分类列表
 */
export function authorizeClassListApi(data: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post<any[]>(
    {
      url: Api.List,
      data,
    },
    {
      errorMessageMode: mode,
    },
  );
}

/**
 * @description: 删除接口分类
 */
export function authorizeClassDeleteApi(id: number | string, mode: ErrorMessageMode = 'message') {
  return defHttp.post<any[]>(
    {
      url: `${Api.Delete}/${id}`,
    },
    {
      errorMessageMode: mode,
    },
  );
}

/**
 * @description: 新增/编辑接口分类
 */
export function authorizeClassUpdateApi(data: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post<Result<null>>(
    {
      url: Api.Update,
      data,
    },
    {
      errorMessageMode: mode,
    },
  );
}

