import { request } from '../../boot/axios';
import { Pagination } from '../class';
import { dictTypeAddOrEditForm, DictTypeSearchEntity } from './model/dict';

//字典接口调用
class DictTypeApi {
  //获取字典类型列表
  getPage = (val: Pagination<DictTypeSearchEntity>) => {
    return request.postForPage('dict/type/page', val);
  };
  getState = () => {
    return request.get('dict/type/dict_status', {});
  };
  //获取类型名称列表
  getList = () => {
    return request.post('dict/type/list', {});
  };
  //添加字典类型
  add = (val: dictTypeAddOrEditForm) => {
    return request.post('dict/type/add', val);
  };
  //修改字典类型
  edit = (val: dictTypeAddOrEditForm) => {
    return request.put('dict/type/edit', val);
  };
  //删除字典类型
  remove = (id: string) => {
    return request.delete('dict/type/remove/' + id);
  };
}
const dictTypeApi = new DictTypeApi();
export { dictTypeApi };
