package VariableDemandSchedules;

import ScheduleUtil.EmployeeCostCalculator;
import ScheduleUtil.SchedulesArray;
import jdistlib.rng.RandomEngine;

public class VariableDemandSchedulesArray extends SchedulesArray {
    private final SchedulesArray initialSchedulesArray;
    private SchedulesArray initialSchedulesArrayVariableDemand;

    public VariableDemandSchedulesArray(SchedulesArray initialSchedulesArray, RandomEngine r) {
        super(initialSchedulesArray);
        this.initialSchedulesArray = initialSchedulesArray;
        generateDemandSimulation(r);
        this.totalScheduleCost = EmployeeCostCalculator.getFullVariableDemandScheduleCost(this, myParametersInitialSchedules);
    }

    private void generateDemandSimulation(RandomEngine r) {
        int[] vd = new VariableDemandVector(this.myParametersInitialSchedules.getWorkPeriodsPerSchedule(), r).getVariableDemandVector();
        int[] adjd = new int[this.myParametersInitialSchedules.getWorkPeriodsPerSchedule()];
        for (int p = 0; p < this.myParametersInitialSchedules.getWorkPeriodsPerSchedule(); p++) {
            adjd[p] = /*this.myParametersInitialSchedules.getRequiredWorkForce(p) + */vd[p];
        }

        this.initialSchedulesArrayVariableDemand = new SchedulesArray(
                myParametersInitialSchedules,
                initialSchedulesArray.fullTimeSchedules,
                initialSchedulesArray.partTimeSchedules,
                initialSchedulesArray.initialScheduleSolutionNumber,
                adjd);
    }

    public SchedulesArray getInitialSchedulesArrayVariableDemand() {
        return initialSchedulesArrayVariableDemand;
    }

    public SchedulesArray getInitialSchedulesArray() {
        return initialSchedulesArray;
    }
}
