import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SysScaleQuestionVO, SysScaleQuestionForm, SysScaleQuestionQuery } from '@/api/scale/SysScaleQuestion/types';

/**
 * 查询量问题内容列表
 * @param query
 * @returns {*}
 */

export const listSysScaleQuestion = (query?: SysScaleQuestionQuery): AxiosPromise<SysScaleQuestionVO[]> => {
  return request({
    url: '/scale/question/pageList',
    method: 'get',
    params: query
  });
};

/**
 * 查询量表所有问题
 * @param query 
 * @returns 
 */
export const findByScaleId = (query: any): AxiosPromise<SysScaleQuestionVO[]> => {
  return request({
    url: '/scale/question/findByScaleId',
    method: 'get',
    params: query
  });
};

/**
 * 查询量问题内容详细
 * @param questionId
 */
export const getSysScaleQuestion = (questionId: string | number): AxiosPromise<SysScaleQuestionVO> => {
  return request({
    url: '/scale/question/' + questionId,
    method: 'get'
  });
};

/**
 * 新增量问题内容
 * @param data
 */
export const addSysScaleQuestion = (data: SysScaleQuestionForm) => {
  return request({
    url: '/scale/question',
    method: 'post',
    data: data
  });
};

/**
 * 修改量问题内容
 * @param data
 */
export const updateSysScaleQuestion = (data: SysScaleQuestionForm) => {
  return request({
    url: '/scale/question',
    method: 'put',
    data: data
  });
};

/**
 * 删除量问题内容
 * @param questionId
 */
export const delSysScaleQuestion = (data: any) => {
  return request({
    url: '/scale/question',
    method: 'delete',
    data
  });
};
