import { http } from '@/utils/http/axios';

/**
 * @description: 配置列表
 */
export function getConfigList(params?) {
  return http.request({
    url: '/config/page',
    method: 'GET',
    params,
  });
}

/**
 * 获取全部配置列表
 * @param params 参数
 * @returns 返回结果
 */
export function getConfigAllList(params?) {
  return http.request({
    url: '/config/list',
    method: 'GET',
    params,
  });
}

/**
 * @description: 根据ID获取详情
 */
export function getConfigDetail(id) {
  return http.request({
    url: '/config/detail/' + id,
    method: 'get',
  });
}

/**
 * @description: 添加配置
 */
export function configAdd(data: any) {
  return http.request({
    url: '/config/add',
    method: 'POST',
    data,
  });
}

/**
 * @description: 更新配置
 */
export function configUpdate(data: any) {
  return http.request({
    url: '/config/update',
    method: 'PUT',
    data,
  });
}

/**
 * @description: 删除配置
 */
export function configDelete(id) {
  return http.request({
    url: '/config/delete/' + id,
    method: 'DELETE',
  });
}

/**
 * @description: 批量删除配置
 */
export function configBatchDelete(data: any) {
  return http.request({
    url: '/config/batchDelete',
    method: 'DELETE',
    data,
  });
}

/**
 * @description: 配置项列表
 */
export function getConfigItemList(params?) {
  return http.request({
    url: '/config/item/page',
    method: 'GET',
    params,
  });
}

/**
 * 获取全部配置项列表
 * @param params 参数
 * @returns 返回结果
 */
export function getConfigItemAllList(params?) {
  return http.request({
    url: '/config/item/list',
    method: 'GET',
    params,
  });
}

/**
 * @description: 根据ID获取详情
 */
export function getConfigItemDetail(id) {
  return http.request({
    url: '/config/item/detail/' + id,
    method: 'get',
  });
}

/**
 * @description: 添加配置项
 */
export function configItemAdd(data: any) {
  return http.request({
    url: '/config/item/add',
    method: 'POST',
    data,
  });
}

/**
 * @description: 更新配置项
 */
export function configItemUpdate(data: any) {
  return http.request({
    url: '/config/item/update',
    method: 'PUT',
    data,
  });
}

/**
 * @description: 删除配置项
 */
export function configItemDelete(id) {
  return http.request({
    url: '/config/item/delete/' + id,
    method: 'DELETE',
  });
}

/**
 * @description: 批量删除配置项
 */
export function configItemBatchDelete(data: any) {
  return http.request({
    url: '/config/item/batchDelete',
    method: 'DELETE',
    data,
  });
}
