package cn.yunzhixue.ability.center.examsprint.application.report;

import cn.yunzhixue.ability.center.examsprint.contracts.report.ExamSprintReportGenerationStatus;
import cn.yunzhixue.ability.center.examsprint.contracts.report.ExamSprintReportType;
import cn.yunzhixue.ability.center.examsprint.domain.report.ReportGenerationStatus;
import cn.yunzhixue.ability.center.examsprint.domain.report.ReportType;

import java.util.Objects;

final class ExamSprintReportContractMapper {

    private ExamSprintReportContractMapper() {
    }

    static ExamSprintReportGenerationStatus toContractStatus(ReportGenerationStatus status) {
        return ExamSprintReportGenerationStatus.valueOf(Objects.requireNonNull(status, "status").name());
    }

    static ExamSprintReportType toContractReportType(ReportType reportType) {
        Objects.requireNonNull(reportType, "reportType");
        return switch (reportType) {
            case OUTLOOK -> ExamSprintReportType.OUTLOOK;
            case ACHIEVEMENT -> ExamSprintReportType.ACHIEVEMENT;
        };
    }

    static ReportType toDomainReportType(ExamSprintReportType reportType) {
        Objects.requireNonNull(reportType, "reportType");
        return switch (reportType) {
            case OUTLOOK -> ReportType.OUTLOOK;
            case ACHIEVEMENT -> ReportType.ACHIEVEMENT;
        };
    }
}
