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

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

// --------------------------------------------------------------------------
// 高中模拟分析导出服务
// --------------------------------------------------------------------------

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

/** 导出联盟区县模拟划线报表 POST /api/ncee/export/export-alliance-district */
export async function exportAllianceDistrict(
    params: {
        /**  */
        nceeplanid: number;
    },
    options?: { [key: string]: any },
) {
    const url = '/api/ncee/export/export-alliance-district';
    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/ncee/export/export-direction-seleted */
export async function exportDirectionSeleted(
    data: API.NceeExportInput,
    options?: { [key: string]: any },
) {
    const url = '/api/ncee/export/export-direction-seleted';
    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;
}

/** 导出未选科的模拟划线报表 POST /api/ncee/export/export-direction-unseleted */
export async function exportDirectionUnseleted(
    params: {
        /**  */
        nceeplanid: number;
    },
    options?: { [key: string]: any },
) {
    const url = '/api/ncee/export/export-direction-unseleted';
    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;
}

export default {
    /** 导出联盟区县模拟划线报表 POST /api/ncee/export/export-alliance-district */
    exportAllianceDistrict,
    /** 导出已选科的模拟划线报表 POST /api/ncee/export/export-direction-seleted */
    exportDirectionSeleted,
    /** 导出未选科的模拟划线报表 POST /api/ncee/export/export-direction-unseleted */
    exportDirectionUnseleted,
};
