import { requestData, requestDownload } from '@/utils/request'

export type DictTypeVO = {
  id: number | undefined
  name: string
  type: string
  status: number
  remark: string
  createTime: Date
}

// 查询字典（精简)列表
export const getSimpleDictTypeList = () => {
  return requestData({ url: '/system/dict-type/list-all-simple', method: 'GET' })
}

// 查询字典列表
export const getDictTypePage = (params: PageParam) => {
  return requestData({ url: '/system/dict-type/page', method: 'GET', params })
}

// 查询字典详情
export const getDictType = (id: number) => {
  return requestData({ url: '/system/dict-type/get?id=' + id, method: 'GET' })
}

// 新增字典
export const createDictType = (data: DictTypeVO) => {
  return requestData({ url: '/system/dict-type/create', method: 'POST', data })
}

// 修改字典
export const updateDictType = (data: DictTypeVO) => {
  return requestData({ url: '/system/dict-type/update', method: 'PUT', data })
}

// 删除字典
export const deleteDictType = (id: number) => {
  return requestData({ url: '/system/dict-type/delete?id=' + id, method: 'DELETE' })
}

// 导出字典类型
export const exportDictType = (params) => {
  return requestDownload({ url: '/system/dict-type/export', method: 'GET', params, responseType: 'blob' })
}
