/*
 * @Author: zjq
 * @description 题库管理
 */
import request from '@/utils/request';

/**
 * @description 新增试题
 * @param {object} data
 */
export const addQuestion = (data: object) => {
    return request({
        url: '/api/v1/Question/Add',
        method: 'post',
        data,
    });
};
/**
 * @description 编辑试题
 * @param {object} data
 */
export const editQuestion = (data: object) => {
    return request({
        url: '/api/v1/Question/Update',
        method: 'put',
        data,
    });
};
/**
 * @description 删除试题
 * @param {object} data
 */
export const deleteQuestion = (data: object) => {
    return request({
        url: '/api/v1/Question/Delete',
        method: 'delete',
        data,
    });
};
/**
 * @description 获取试题列表
 * @param {object} params
 */
export const getQuestionData = (params?: object) => {
    return request({
        url: '/api/v1/Question/GetPagedList',
        method: 'post',
        data: params,
    });
};
/**
 * @description 查询试题详情
 * @param {object} Id
 */
export const getQuestionDetail = (Id: any) => {
    return request({
        url: `/api/v1/Question/Get?id=${Id}`,
        method: 'get',
    });
};
/**
 * @description 批量下载文件 （文件服务）
 * @param {object}  params
 */
export const fileDownloadBatch = (params: object) => {
    return request({
        url: `/file/downloadfile_batch`,
        method: 'get',
        responseType: 'blob',
        params,
        baseURL: import.meta.env.VITE_API_UPLOAD_URL,
    },{
        reduce_data_format:false
    });
};
/**
 * @description  获取试题模板下载链接
 * @param {object} params
 * @return {*}
 */
export const questionTemplate = (params?: object) => {
    return request({
        url: `/api/v1/Question/Download`,
        method: 'get',
        responseType: 'blob'
    },{
        reduce_data_format:false
    });
};
/**
 * @description  试题导入
 * @param {object} data
 * @return {*}
 */
export const questionImport = (data: object) => {
    return request({
        url: `/api/v1/Question/ImportExcel`,
        method: 'post',
        data,
        headers: {
            'Content-Type':'multipart/form-data'
        },
    });
};