package jnpf.attendance.schedule;

import java.io.Serializable;

/**
 * 历史发现的固定班次与考勤组 {@code ShiftPeriodVo} 匹配阈值（产品：覆盖度、有效率）。
 */
public final class AttendanceGroupShiftMatchConfig implements Serializable {

    /** 历史时段覆盖度 = 重叠时长 / 历史班次时长 */
    private final double minHistoryCoverageRatio;
    /** 候选班次有效率 = 重叠时长 / 候选考勤班次总时长（防超排） */
    private final double minCandidateEfficiencyRatio;

    public AttendanceGroupShiftMatchConfig(
            double minHistoryCoverageRatio, double minCandidateEfficiencyRatio) {
        if (minHistoryCoverageRatio < 0 || minHistoryCoverageRatio > 1) {
            throw new IllegalArgumentException("minHistoryCoverageRatio must be in [0,1]");
        }
        if (minCandidateEfficiencyRatio < 0 || minCandidateEfficiencyRatio > 1) {
            throw new IllegalArgumentException("minCandidateEfficiencyRatio must be in [0,1]");
        }
        this.minHistoryCoverageRatio = minHistoryCoverageRatio;
        this.minCandidateEfficiencyRatio = minCandidateEfficiencyRatio;
    }

    public static AttendanceGroupShiftMatchConfig defaults() {
        return new AttendanceGroupShiftMatchConfig(0.7d, 0.6d);
    }

    public double getMinHistoryCoverageRatio() {
        return minHistoryCoverageRatio;
    }

    public double getMinCandidateEfficiencyRatio() {
        return minCandidateEfficiencyRatio;
    }
}
