import { fetch, post } from '@api/api';

/**
 * 查询字典
 */
export function fetchDict() {
  return fetch({
    url: '/upms/dictionary/query-dictionaries'
  });
}

/**
 * 查询字典
 * @param params 请求参数
 * @param headers 请求头
 */
export function fetchDictionaries(params = {}, headers = {}) {
  return fetch({
    url: '/upms/dictionary/page',
    params: params,
    headers: headers
  });
}

/**
 * 新增字典
 * @param params 请求参数
 * @param headers 请求头
 */
export function createDictionary(params = {}, headers = {}) {
  return post({
    url: '/upms/dictionary/create',
    params: params,
    headers: headers
  });
}

/**
 * 更新字典
 * @param params 请求参数
 * @param headers 请求头
 */
export function updateDictionary(params = {}, headers = {}) {
  return post({
    url: '/upms/dictionary/update',
    params: params,
    headers: headers
  });
}

/**
 * 删除字典
 * @param params 请求参数
 * @param headers 请求头
 */
export function removeDictionary(params = {}, headers = {}) {
  return post({
    url: '/upms/dictionary/remove',
    params: params,
    headers: headers
  });
}

// =======================字典项===========================
/**
 * 查询DictionaryOption
 * @param params 请求参数
 * @param headers 请求头
 */
export function fetchDictionaryOptionPage(params = {}, headers = {}) {
  return fetch({
    url: '/upms/dictionary/options',
    params: params,
    headers: headers
  });
}

/**
 * 新增DictionaryOption
 * @param params 请求参数
 * @param headers 请求头
 */
export function createDictionaryOption(params = {}, headers = {}) {
  return post({
    url: '/upms/dictionary/option/create',
    params: params,
    headers: headers
  });
}

/**
 * 更新DictionaryOption
 * @param params 请求参数
 * @param headers 请求头
 */
export function updateDictionaryOption(params = {}, headers = {}) {
  return post({
    url: '/upms/dictionary/option/update',
    params: params,
    headers: headers
  });
}

/**
 * 删除DictionaryOption
 * @param params 请求参数
 * @param headers 请求头
 */
export function removeDictionaryOption(params = {}, headers = {}) {
  return post({
    url: '/upms/dictionary/option/remove',
    params: params,
    headers: headers
  });
}

/**
 * 刷新字典
 * @param params 请求参数
 * @param headers 请求头
 */
export function refreshDictionary(params = {}, headers = {}) {
  return post({
    url: '/upms/dictionary/refresh',
    params: params,
    headers: headers
  });
}
