import { fetch, post, ApiResponse } from './index'

export function fetchDict(params = {}): Promise<ApiResponse<Record<string, any[]>>> {
  return fetch({ url: '/upms/dictionary/query-dictionaries', params })
}

export function queryDictPage(params = {}): Promise<ApiResponse<any>> {
  return fetch({ url: '/upms/dictionary/page', params })
}

export function createDict(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/dictionary/create', params })
}

export function updateDict(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/dictionary/update', params })
}

export function removeDict(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/dictionary/remove', params })
}

export function queryDictOptions(params = {}): Promise<ApiResponse<any[]>> {
  return fetch({ url: '/upms/dictionary/options', params })
}

export function createDictOption(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/dictionary/option/create', params })
}

export function updateDictOption(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/dictionary/option/update', params })
}

export function removeDictOption(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/dictionary/option/remove', params })
}

export function refreshDict(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/dictionary/refresh', params })
}
