import httpClient from '@/utils/http';

import {
  ControllerResponse,
  ServiceScoreCalculateRequest,
  ServiceScoreCalculateResponse,
  ServiceScorePublishRequest,
  ServiceScorePublishResponse
} from './data-contracts';
export default {
  /**
   * @description 从答题明细中聚合分数并回写到答题卡信息，设置状态为registered，并将明细由completed改为registered
   */
  calculateCreate: (body: ServiceScoreCalculateRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ServiceScoreCalculateResponse;
      }
    >(`/score-publish/calculate`, { params: body });
  },
  /**
   * @description 将已 registered 的答题卡发布为 published
   */
  publishCreate: (body: ServiceScorePublishRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ServiceScorePublishResponse;
      }
    >(`/score-publish/publish`, { params: body });
  }
};
