import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QuestionUserAnswerVO, QuestionUserAnswerForm, QuestionUserAnswerQuery } from '@/api/safety/questionUserAnswer/types';

/**
 * 查询用户试卷存储列表
 * @param query
 * @returns {*}
 */

export const listQuestionUserAnswer = (query?: QuestionUserAnswerQuery): AxiosPromise<QuestionUserAnswerVO[]> => {
  return request({
    url: '/safety/questionUserAnswer/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户试卷存储详细
 * @param id
 */
export const getQuestionUserAnswer = (id: string | number): AxiosPromise<QuestionUserAnswerVO> => {
  return request({
    url: '/safety/questionUserAnswer/' + id,
    method: 'get'
  });
};

/**
 * 新增用户试卷存储
 * @param data
 */
export const addQuestionUserAnswer = (data: QuestionUserAnswerForm) => {
  return request({
    url: '/safety/questionUserAnswer',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户试卷存储
 * @param data
 */
export const updateQuestionUserAnswer = (data: QuestionUserAnswerForm) => {
  return request({
    url: '/safety/questionUserAnswer',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户试卷存储
 * @param id
 */
export const delQuestionUserAnswer = (id: string | number | Array<string | number>) => {
  return request({
    url: '/safety/questionUserAnswer/' + id,
    method: 'delete'
  });
};
