import { defHttp } from '@/utils/http/axios';
import { AccountListGetResultModel, AccountListItem, AccountParams } from './model/index';
enum Api {
  tableList = '/api/BaseDataAuth/GetPageList/permission/data/page',
  getDetailData = '/api/BaseDataAuth/GetEntity/permission/data',
  addData = '/api/BaseDataAuth/AddForm/permission/data',
  editData = '/api/BaseDataAuth/UpdateForm/permission/data/',
  delData = '/api/BaseDataAuth/DeleteForm/permission/data/',
  fieldOptions = '/api/BaseDataAuth/GetEntityByCode',
}
export const getTablesListData = (params?: AccountParams) => {
  return defHttp.get<AccountListGetResultModel>({
    url: Api.tableList,
    params,
  });
};
export const getDetailsData = (params?: AccountParams) => {
  return defHttp.get<AccountListGetResultModel>({
    url: Api.getDetailData,
    params,
  });
};
export const getFieldListData = (params?: AccountParams) => {
  return defHttp.get<AccountListGetResultModel>({
    url: Api.fieldOptions,
    params,
  });
};
export const addTableData = (params?: AccountParams) => {
  return defHttp.post<AccountListGetResultModel>({
    url: Api.addData,
    params,
  });
};
export const editTableData = (params?: AccountParams) => {
  return defHttp.post<AccountListGetResultModel>({
    url: Api.editData + params.id,
    params,
  });
};
export const delTableData = (params?: AccountParams) => {
  return defHttp.post<AccountListGetResultModel>({
    url: Api.delData + params.id,
    params,
  });
};
