import axios, { AxiosResponse } from 'axios';
import {
  ScanCousreListPageParam,
  ScanCourseListFilter,
  ScanPointListPageParam,
  ScanPointListFilter,
  ScanListPageRes,
  SignPaperStatListPageParam,
  SignPaperStatListPageRes,
} from './types/scan';

// 扫描管理
// 按科目统计列表
export function getScanCourseList(
  params: ScanCousreListPageParam
): Promise<ScanListPageRes> {
  return axios.post('/api/admin/scan/subject', params);
}

// 按考点统计列表
export function getScanPointList(
  params: ScanPointListPageParam
): Promise<ScanListPageRes> {
  return axios.post('/api/admin/scan/examSite', params);
}

// 签到表统计列表
export function getSignPaperStatList(
  params: SignPaperStatListPageParam
): Promise<SignPaperStatListPageRes> {
  return axios.post('/api/admin/scan/package', params);
}

// 按考点导出
export function exportScanStatByPoint(
  params: ScanPointListFilter
): Promise<AxiosResponse<Blob>> {
  return axios.post('/api/admin/scan/examSite/export', params, {
    responseType: 'blob',
  });
}
// 按科目导出
export function exportScanStatByCourse(
  params: ScanCourseListFilter
): Promise<AxiosResponse<Blob>> {
  return axios.post('/api/admin/scan/subject/export', params, {
    responseType: 'blob',
  });
}
