import httpClient from '@/utils/http';

import {
  ControllerResponse,
  ExamCreateExamReportSettingRequest,
  ExamExamReportSettingResponse,
  ExamUpdateExamReportSettingRequest
} from './data-contracts';
export default {
  /**
   * @description 创建新的考试报告发布设置记录
   */
  examReportSettingsCreate: (setting: ExamCreateExamReportSettingRequest) => {
    return httpClient.post<
      ControllerResponse & {
        /** 考试报告发布设置信息响应 */
        data?: ExamExamReportSettingResponse;
      }
    >(`/exam-report-settings`, { params: setting });
  },
  /**
   * @description 根据考试ID获取该考试的所有报告发布设置
   */
  examDetail: (examId: number) => {
    return httpClient.get<
      ControllerResponse & {
        data?: ExamExamReportSettingResponse[];
      }
    >(`/exam-report-settings/exam/${examId}`);
  },
  /**
   * @description 根据ID更新考试报告发布设置信息，支持部分字段更新
   */
  examReportSettingsUpdate: (id: number, setting: ExamUpdateExamReportSettingRequest) => {
    return httpClient.put<
      ControllerResponse & {
        /** 考试报告发布设置信息响应 */
        data?: ExamExamReportSettingResponse;
      }
    >(`/exam-report-settings/${id}`, { params: setting });
  },
  /**
   * @description 根据ID删除考试报告发布设置记录
   */
  examReportSettingsDelete: (id: number) => {
    return httpClient.delete<
      ControllerResponse & {
        message?: string;
      }
    >(`/exam-report-settings/${id}`);
  }
};
