import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ScreeningAssessmentQuestionVO, ScreeningAssessmentQuestionForm, ScreeningAssessmentQuestionQuery } from '@/api/system/screeningAssessmentQuestion/types';

/**
 * 查询题目列表
 * @param query
 * @returns {*}
 */

export const listScreeningAssessmentQuestion = (query?: ScreeningAssessmentQuestionQuery): AxiosPromise<ScreeningAssessmentQuestionVO[]> => {
  return request({
    url: '/system/screeningAssessmentQuestion/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询题目详细
 * @param questionId
 */
export const getScreeningAssessmentQuestion = (questionId: string | number): AxiosPromise<ScreeningAssessmentQuestionVO> => {
  return request({
    url: '/system/screeningAssessmentQuestion/' + questionId,
    method: 'get'
  });
};

/**
 * 新增题目
 * @param data
 */
export const addScreeningAssessmentQuestion = (data: ScreeningAssessmentQuestionForm) => {
  return request({
    url: '/system/screeningAssessmentQuestion',
    method: 'post',
    data: data
  });
};

/**
 * 修改题目
 * @param data
 */
export const updateScreeningAssessmentQuestion = (data: ScreeningAssessmentQuestionForm) => {
  return request({
    url: '/system/screeningAssessmentQuestion',
    method: 'put',
    data: data
  });
};

/**
 * 删除题目
 * @param questionId
 */
export const delScreeningAssessmentQuestion = (questionId: string | number | Array<string | number>) => {
  return request({
    url: '/system/screeningAssessmentQuestion/' + questionId,
    method: 'delete'
  });
};
