import type { BaseModel, PageQuery } from '#/api/baseModel';

import { requestClient } from '#/api/request';

export namespace DictApi {
  export interface Dict extends BaseModel {
    /**
     * 字典名称
     */
    dictName: string;

    /**
     * 字典类型
     */
    dictType: string;

    /**
     * 描述
     */
    description?: string;

    /**
     * 备注
     */
    remark?: string;
  }
}

/**
 * 查询字典类型列表
 * @param query
 * @returns {*}
 */

export function apiPage(params: PageQuery) {
  return requestClient.get('/system/dict/page', { params });
}

/**
 * 查询字典类型详细
 * @param id
 */
export function apiDetail(id: number) {
  return requestClient.get(`/system/dict/detail/${id}`);
}

/**
 * 新增字典类型
 * @param data
 */
export function apiAdd(data: DictApi.Dict) {
  return requestClient.post('/system/dict', data);
}

/**
 * 修改字典类型
 * @param data
 */
export function apiUpdate(data: DictApi.Dict) {
  return requestClient.put('/system/dict', data);
}

/**
 * 删除字典类型
 * @param id
 */
export function apiDelete(id: Array<number> | number) {
  return requestClient.delete(`/system/dict/${id}`);
}
/**
 * 导出字典类型
 * @params query
 */
export function apiExport(params?: PageQuery) {
  return requestClient.post('/system/dict/export', params);
}

/**
 * 导出字典类型
 */
export function apiOptionselect() {
  return requestClient.get('/system/dict/optionselect');
}
