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;

final class ExamSprintReportContractMapper {

    private ExamSprintReportContractMapper() {
    }

    static ExamSprintReportGenerationStatus toContractStatus(ReportGenerationStatus status) {
        return status == null ? null : ExamSprintReportGenerationStatus.valueOf(status.name());
    }

    static ExamSprintReportType toContractReportType(ReportType reportType) {
        if (reportType == null) {
            return null;
        }
        return switch (reportType) {
            case OUTLOOK -> ExamSprintReportType.OUTLOOK;
            case ACHIEVEMENT -> ExamSprintReportType.ACHIEVEMENT;
        };
    }

    static ReportType toDomainReportType(ExamSprintReportType reportType) {
        if (reportType == null) {
            return null;
        }
        return switch (reportType) {
            case OUTLOOK -> ReportType.OUTLOOK;
            case ACHIEVEMENT -> ReportType.ACHIEVEMENT;
        };
    }
}
