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

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

// --------------------------------------------------------------------------
// 家长问卷填答进度管理服务
// --------------------------------------------------------------------------

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

/** 查询学生家长问卷明细 POST /api/exam/patriarch/questionnaire/progress/query-page-list */
export async function queryPageList(
    data: API.ExamStudentPatriarchQuestionnaireProgressPageInput,
    options?: { [key: string]: any },
) {
    const url = '/api/exam/patriarch/questionnaire/progress/query-page-list';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<
        API.ResponseType<API.PageResponse<API.ExamStudentPatriarchQuestionnaireProgressOutput>>
    >(url, config);
    return res?.data;
}

/** 导出未填答学生名单 POST /api/exam/patriarch/questionnaire/progress/export-uncompleted-excel */
export async function exportUncompletedExcel(
    data: API.ExportExamPatriarchQuestionnaireProgressInput,
    options?: { [key: string]: any },
) {
    const url = '/api/exam/patriarch/questionnaire/progress/export-uncompleted-excel';
    const config = {
        method: 'POST',
        data,
        ...(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;
}

/** 获取各班级问卷填答进度 GET /api/exam/patriarch/questionnaire/progress/get-progress-list */
export async function getProgressList(
    params: {
        /**  */
        examplanid: number;
    },
    options?: { [key: string]: any },
) {
    const url = '/api/exam/patriarch/questionnaire/progress/get-progress-list';
    const config = { method: 'GET', params, ...(options || {}) };
    const res = await request<
        API.ResponseType<API.ExamStudentPatriarchQuestionnaireProgressStatOutput[]>
    >(url, config);
    return res?.data;
}

export default {
    /** 查询学生家长问卷明细 POST /api/exam/patriarch/questionnaire/progress/query-page-list */
    queryPageList,
    /** 导出未填答学生名单 POST /api/exam/patriarch/questionnaire/progress/export-uncompleted-excel */
    exportUncompletedExcel,
    /** 获取各班级问卷填答进度 GET /api/exam/patriarch/questionnaire/progress/get-progress-list */
    getProgressList,
};
