// @ts-ignore
/* eslint-disable */

// 该文件自动生成，请勿手动修改！

// --------------------------------------------------------------------------
// 监测教师任教科目管理服务
// --------------------------------------------------------------------------

import { request, RequestOptions } from '@umijs/max';
import contentDisposition from 'content-disposition';

/** 上传批量导入文件 POST /api/exam/teacher/course/upload */
export async function upload(data: FormData, options?: { [key: string]: any }) {
    const url = '/api/exam/teacher/course/upload';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<
        API.ResponseType<API.UploadExamDataOutput_UploadExamTeacherCourseOutput>
    >(url, config);
    return res?.data;
}

/** 批量导入监测教师 POST /api/exam/teacher/course/import */
export async function importAction(
    data: API.ImportExamTeacherCourseInput,
    options?: { [key: string]: any },
) {
    const url = '/api/exam/teacher/course/import';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<any>>(url, config);
    return res?.data;
}

/** 导出TQES导入文件格式文件包 POST /api/exam/teacher/course/export-tqes-file */
export async function exportTqesFile(
    params: {
        /**  */
        examplanid: number;
    },
    options?: { [key: string]: any },
) {
    const url = '/api/exam/teacher/course/export-tqes-file';
    const config = {
        method: 'POST',
        params,
        ...(options || {}),
        responseType: 'blob',
        getResponse: true,
    } as RequestOptions;
    const res = await request(url, config);
    const hcd = res.request.getResponseHeader('Content-Disposition');
    if (!hcd) {
        return null;
    }
    let fileName = '';
    const cd = contentDisposition.parse(hcd);
    if (cd?.parameters?.filename) {
        fileName = cd?.parameters?.filename;
    }
    return { fileName, data: res.data as Blob } as API.FileResponse;
}

/** 添加监测教师 POST /api/exam/teacher/course/add */
export async function add(data: API.AddExamTeacherCourseInput, options?: { [key: string]: any }) {
    const url = '/api/exam/teacher/course/add';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<any>>(url, config);
    return res?.data;
}

/** 更新监测教师 POST /api/exam/teacher/course/update */
export async function update(
    data: API.UpdateExamTeacherCourseInput,
    options?: { [key: string]: any },
) {
    const url = '/api/exam/teacher/course/update';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<any>>(url, config);
    return res?.data;
}

/** 删除监测教师 POST /api/exam/teacher/course/del */
export async function del(data: API.BaseId, options?: { [key: string]: any }) {
    const url = '/api/exam/teacher/course/del';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<any>>(url, config);
    return res?.data;
}

/** 清空监测教师 POST /api/exam/teacher/course/clear */
export async function clear(
    data: API.ClearExamTeacherCourseInput,
    options?: { [key: string]: any },
) {
    const url = '/api/exam/teacher/course/clear';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<any>>(url, config);
    return res?.data;
}

/** 分页查询监测教师列表 POST /api/exam/teacher/course/query-page-list */
export async function queryPageList(
    data: API.ExamTeacherCoursePageInput,
    options?: { [key: string]: any },
) {
    const url = '/api/exam/teacher/course/query-page-list';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<API.PageResponse<API.ExamTeacherCourseOutput>>>(
        url,
        config,
    );
    return res?.data;
}

export default {
    /** 上传批量导入文件 POST /api/exam/teacher/course/upload */
    upload,
    /** 批量导入监测教师 POST /api/exam/teacher/course/import */
    importAction,
    /** 导出TQES导入文件格式文件包 POST /api/exam/teacher/course/export-tqes-file */
    exportTqesFile,
    /** 添加监测教师 POST /api/exam/teacher/course/add */
    add,
    /** 更新监测教师 POST /api/exam/teacher/course/update */
    update,
    /** 删除监测教师 POST /api/exam/teacher/course/del */
    del,
    /** 清空监测教师 POST /api/exam/teacher/course/clear */
    clear,
    /** 分页查询监测教师列表 POST /api/exam/teacher/course/query-page-list */
    queryPageList,
};
