import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SysScaleFormulaVO, SysScaleFormulaForm, SysScaleFormulaQuery } from '@/api/scale/SysScaleFormula/types';

/**
 * 查询测评量公式列表
 * @param query
 * @returns {*}
 */

export const listSysScaleFormula = (query?: SysScaleFormulaQuery): AxiosPromise<SysScaleFormulaVO[]> => {
  return request({
    url: '/scale/formula/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询测评量公式详细
 * @param formulaId
 */
export const getSysScaleFormula = (formulaId: string | number): AxiosPromise<SysScaleFormulaVO> => {
  return request({
    url: '/scale/formula/' + formulaId,
    method: 'get'
  });
};

/**
 * 新增测评量公式
 * @param data
 */
export const addSysScaleFormula = (data: SysScaleFormulaForm) => {
  return request({
    url: '/scale/formula',
    method: 'post',
    data: data
  });
};

/**
 * 修改测评量公式
 * @param data
 */
export const updateSysScaleFormula = (data: SysScaleFormulaForm) => {
  return request({
    url: '/scale/formula',
    method: 'put',
    data: data
  });
};

/**
 * 删除测评量公式
 * @param formulaId
 */
export const delSysScaleFormula = (formulaId: string | number | Array<string | number>) => {
  return request({
    url: '/scale/formula/' + formulaId,
    method: 'delete'
  });
};
