import { request } from '@@/plugin-request/request';
import { stringify } from 'qs';

/**
 * 查询参数配置列表数据
 * @param params
 */
export async function queryParameters(params: object) {
  return request(`/web/v1/system_parameters?${stringify(params)}`);
}

/**
 * 编辑参数配置
 * @param params
 */
export async function editParameters(params: any) {
  return request(`/web/v1/system_parameters/${params.record_id}`, {
    method: 'PUT',
    data: params,
  });
}

/**
 * 新增参数配置
 * @param params
 */
export async function createParameters(params: object) {
  return request(`/web/v1/system_parameters`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 删除参数配置
 * @param record_id
 */
export async function delParameters(record_id: any) {
  return request(`/web/v1/system_parameters/${record_id}`, {
    method: 'DELETE',
  });
}

/**
 * 启用
 * @param id
 */
export async function enableParameters(id: string) {
  return request(`/web/v1/system_parameters/${id}/enable`, {
    method: 'PATCH',
  });
}

/**
 * 禁用
 * @param id
 */
export async function disableParameters(id: string) {
  return request(`/web/v1/system_parameters/${id}/disable`, {
    method: 'PATCH',
  });
}
