import request from '/@/utils/request';

/**
 * 分页查询毕业学生核对数据
 * @param query 查询参数
 */
export const fetchList = (query?: any) => {
	return request({
		url: '/basic/graduverify/page',
		method: 'get',
		params: query,
	});
};

/**
 * 导入毕业学籍回流数据并核对
 * @param file 文件
 */
export const importData = (file: File) => {
	const formData = new FormData();
	formData.append('file', file);
	return request({
		url: '/basic/graduverify/import',
		method: 'post',
		data: formData,
		headers: {
			'Content-Type': 'multipart/form-data',
		},
	});
};

/**
 * 导出核对数据
 * @param data 查询条件
 */
export const exportData = (data: any) => {
	return request({
		url: '/basic/graduverify/export',
		method: 'post',
		data,
		responseType: 'blob',
	});
};

/**
 * 下发至班主任核对
 * @param batchNo 批次号
 */
export const sendToClassMaster = (batchNo: string) => {
	return request({
		url: '/basic/graduverify/send',
		method: 'post',
		params: { batchNo },
	});
};

/**
 * 提交核对结果
 * @param id 记录ID
 * @param verifyResult 核对结果
 */
export const submitVerify = (id: string, verifyResult: string) => {
	return request({
		url: '/basic/graduverify/verify',
		method: 'post',
		params: { id, verifyResult },
	});
};

/**
 * 获取待核对统计
 * @param classMasterCode 班主任工号
 */
export const getPendingCount = (classMasterCode?: string) => {
	return request({
		url: '/basic/graduverify/pending-count',
		method: 'get',
		params: { classMasterCode },
	});
};

/**
 * 下载导入模板
 */
export const downloadTemplate = () => {
	return request({
		url: '/basic/graduverify/template',
		method: 'get',
		responseType: 'blob',
	});
};
