import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SysScaleVO, SysScaleForm, SysScaleQuery } from '@/api/scale/SysScale/types';

/**
 * 查询心理测评量列表
 * @param query
 * @returns {*}
 */

export const listSysScale = (query?: SysScaleQuery): AxiosPromise<SysScaleVO[]> => {
  return request({
    url: '/scale/info/pageList',
    method: 'get',
    params: query
  });
};

/**
 * 查询所有量表
 * @param query
 * @returns
 */
export const findAll = (query?: SysScaleQuery): AxiosPromise<SysScaleVO> => {
  return request({
    url: '/scale/info/findAll',
    method: 'get',
    params: query
  });
};

/**
 * 查询心理测评量详细
 * @param scaleId
 */
export const getSysScale = (scaleId: string | number): AxiosPromise<SysScaleVO> => {
  return request({
    url: '/scale/info/' + scaleId,
    method: 'get'
  });
};

/**
 * 新增心理测评量
 * @param data
 */
export const addSysScale = (data: SysScaleForm) => {
  return request({
    url: '/scale/info',
    method: 'post',
    data: data
  });
};

/**
 * 修改心理测评量
 * @param data
 */
export const updateSysScale = (data: SysScaleForm) => {
  return request({
    url: '/scale/info',
    method: 'put',
    data: data
  });
};

/**
 * 删除心理测评量
 * @param scaleId
 */
export const delSysScale = (scaleId: string | number | Array<string | number>) => {
  return request({
    url: '/scale/info/' + scaleId,
    method: 'delete'
  });
};
