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

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

// --------------------------------------------------------------------------
// 缺测替补管理服务
// --------------------------------------------------------------------------

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

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

/** 批量导入监测缺测替补 POST /api/exam/absent/replace/import */
export async function importAction(
    data: API.ImportExamAbsentReplaceInput,
    options?: { [key: string]: any },
) {
    const url = '/api/exam/absent/replace/import';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<number>>(url, config);
    return res?.data;
}

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

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

/** 上传特殊学生佐证材料 POST /api/exam/absent/replace/upload-attachment */
export async function uploadAttachment(data: FormData, options?: { [key: string]: any }) {
    const url = '/api/exam/absent/replace/upload-attachment';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<any>>(url, config);
    return res?.data;
}

/** 删除特殊学生佐证材料 POST /api/exam/absent/replace/del-attachment */
export async function delAttachment(
    data: API.DeleteAttachmentInput,
    options?: { [key: string]: any },
) {
    const url = '/api/exam/absent/replace/del-attachment';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<any>>(url, config);
    return res?.data;
}

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

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

/** 导出监测缺测替补上报打印表格 POST /api/exam/absent/replace/export-print-table */
export async function exportPrintTable(
    params: {
        /**  */
        examplanid?: number;
    },
    options?: { [key: string]: any },
) {
    const url = '/api/exam/absent/replace/export-print-table';
    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/absent/replace/query-page-list */
export async function queryPageList(
    data: API.ExamAbsentReplacePageInput,
    options?: { [key: string]: any },
) {
    const url = '/api/exam/absent/replace/query-page-list';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<API.PageResponse<API.ExamAbsentReplaceOutput>>>(
        url,
        config,
    );
    return res?.data;
}

/** 获取机构班级特殊学生上报人数统计列表 GET /api/exam/absent/replace/get-org-grade-class-student-count */
export async function getOrgGradeClassStudentCount(
    params: {
        /**  */
        examplanid?: number;
        /**  */
        sysorgid?: number;
    },
    options?: { [key: string]: any },
) {
    const url = '/api/exam/absent/replace/get-org-grade-class-student-count';
    const config = { method: 'GET', params, ...(options || {}) };
    const res = await request<API.ResponseType<API.ExamAbsentReplaceCountOutput>>(url, config);
    return res?.data;
}

/** 获取状态数量 POST /api/exam/absent/replace/query-status-count */
export async function queryStatusCount(
    data: API.ExamAbsentReplacePageInput,
    options?: { [key: string]: any },
) {
    const url = '/api/exam/absent/replace/query-status-count';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<API.StatusCount[]>>(url, config);
    return res?.data;
}

export default {
    /** 上传批量导入文件 POST /api/exam/absent/replace/upload */
    upload,
    /** 批量导入监测缺测替补 POST /api/exam/absent/replace/import */
    importAction,
    /** 添加监测缺测替补 POST /api/exam/absent/replace/add */
    add,
    /** 更新监测缺测替补 POST /api/exam/absent/replace/update */
    update,
    /** 上传特殊学生佐证材料 POST /api/exam/absent/replace/upload-attachment */
    uploadAttachment,
    /** 删除特殊学生佐证材料 POST /api/exam/absent/replace/del-attachment */
    delAttachment,
    /** 删除监测缺测替补 POST /api/exam/absent/replace/del */
    del,
    /** 清空监测缺测替补 POST /api/exam/absent/replace/clear */
    clear,
    /** 导出监测缺测替补上报打印表格 POST /api/exam/absent/replace/export-print-table */
    exportPrintTable,
    /** 分页查询监测缺测替补列表 POST /api/exam/absent/replace/query-page-list */
    queryPageList,
    /** 获取机构班级特殊学生上报人数统计列表 GET /api/exam/absent/replace/get-org-grade-class-student-count */
    getOrgGradeClassStudentCount,
    /** 获取状态数量 POST /api/exam/absent/replace/query-status-count */
    queryStatusCount,
};
