import httpClient from '@/utils/http';

import {
  ApiResult,
  ScanExamRequest,
  ScanRequest,
  ScanStatusInfoApiResult,
  ScanTaskApiResult,
  ScanTaskListApiResult,
  ScanTemplateResultApiResult,
  ScannerInfoListApiResult,
  StringApiResult
} from './data-contracts';
export default {
  /**
   * No description
   */
  scannerGetScanStatusList: () => {
    return httpClient.get<ScanStatusInfoApiResult>(`/api/scanner/getScanStatus`);
  },
  /**
   * No description
   */
  scannerGetScannersList: () => {
    return httpClient.get<ScannerInfoListApiResult>(`/api/scanner/getScanners`);
  },
  /**
   * No description
   */
  scannerScanTemplateCreate: (data: ScanRequest) => {
    return httpClient.post<ScanTemplateResultApiResult>(`/api/scanner/scanTemplate`, {
      params: data
    });
  },
  /**
   * No description
   */
  scannerScanExamCreate: (data: ScanExamRequest) => {
    return httpClient.post<ScanTaskApiResult>(`/api/scanner/scanExam`, { params: data });
  },
  /**
   * No description
   */
  scannerCancelScanCreate: () => {
    return httpClient.post<ApiResult>(`/api/scanner/cancelScan`);
  },
  /**
   * No description
   */
  scannerTaskDetail: (taskId: string) => {
    return httpClient.get<ScanTaskApiResult>(`/api/scanner/task/${taskId}`);
  },
  /**
   * No description
   */
  scannerTasksList: () => {
    return httpClient.get<ScanTaskListApiResult>(`/api/scanner/tasks`);
  },
  /**
   * No description
   */
  scannerImageList: (query: {
    /** 图片的相对路径，例如：ScanImages/20240809/20240809143025123_0001.jpg */
    imagePath?: string;
  }) => {
    return httpClient.download<Blob>(`/api/scanner/image`, { query: query });
  },
  /**
   * No description
   */
  scannerLocalUploadAnswerSheetCreate: (data: {
    /**
     * 学校ID (答题卡扫描使用)
     * @format int32
     */
    SchoolId?: number;
    /**
     * 考试科目ID (答题卡扫描使用)
     * @format int32
     */
    ExamSubjectId?: number;
    /** 需比较的AI模板ID (答题卡扫描使用) */
    AITemplateId?: string;
    /**
     * 模板ID
     * @format int32
     */
    TemplateId?: number;
    /**
     * 模板图片页数 (答题卡扫描使用)
     * @format int32
     */
    TemplatePages?: number;
    /**
     * 批次ID，后端生成的唯一标识符，用于区分不同的答题卡批次
     * @format int32
     */
    BatchId?: number;
    /** 批次号 */
    BatchNo?: string;
  }) => {
    return httpClient.formData<StringApiResult>(`/api/scanner/localUploadAnswerSheet`, {
      params: data
    });
  }
};
