package InitialSchedules;

// classe statique pour mettre fonction utilitaire
public class UtilInitialSchedules {

    private UtilInitialSchedules() {
    }

    public static void refineInitialSchedules() {
        // A implementer si on veut rafiner la banque d'horaires initiales
    }

    public static void printSolutionResults(ModelInitialSchedules myModelInitialSchedules, ParametersInitialSchedules myScheduleParameters) {
        // Cette fonction sera a ameliorer avec des sous-fonctions, car elle n'est pas tres explicite.
        System.out.print("Schedule Day         ");
        for (int day = 1; day <= myScheduleParameters.daysPerSchedule; day++) {
            System.out.print(day);
            System.out.print("    ");
            if (day < 10) {
                System.out.print(" ");
            }
            System.out.print("|");
        }
        System.out.print("Worked Periods");
        System.out.println("");
        System.out.println("Part-Time Employees");
        int partTimeemployeeNo = 1;
        for (int employee = 0; employee < myModelInitialSchedules.maxPartTimeEmployee; employee++) {
            if (myModelInitialSchedules.workingPeriodsPerPartTimeEmployees[employee].getValue() >= 0) {
                System.out.print("Employee ");
                System.out.print(partTimeemployeeNo);
                System.out.print("          ");
                if (partTimeemployeeNo < 10) {
                    System.out.print(" ");
                }
                for (int workPeriod = 0; workPeriod < myScheduleParameters.workPeriodsPerSchedule; workPeriod++) {
                    if (myModelInitialSchedules.workPeriodsSchedulesOfPartTimeEmployees[employee][workPeriod].getValue() == 1) {
                        System.out.print("1");
                    } else {
                        System.out.print("0");

                    }
                    if (workPeriod % myScheduleParameters.workPeriodsPerDay == 5 && workPeriod != 0) {
                        System.out.print("|");
                    }
                }
                System.out.print(myModelInitialSchedules.workingPeriodsPerPartTimeEmployees[employee].getValue());
                System.out.println("");
                partTimeemployeeNo++;
            }
        }
        int fullTimeemployeeNo = 1;
        System.out.println("Full-Time Employees");
        for (int employee = 0; employee < myModelInitialSchedules.maxFullTimeEmployee; employee++) {
            if (myModelInitialSchedules.workingPeriodsPerFullTimeEmployees[employee].getValue() >= 0) {
                System.out.print("Employee ");
                System.out.print(fullTimeemployeeNo);
                System.out.print("          ");
                if (fullTimeemployeeNo < 10) {
                    System.out.print(" ");
                }
                for (int workPeriod = 0; workPeriod < myScheduleParameters.workPeriodsPerSchedule; workPeriod++) {
                    if (myModelInitialSchedules.workPeriodsSchedulesOfFullTimeEmployees[employee][workPeriod].getValue() == 1) {
                        System.out.print("1");
                    } else {
                        System.out.print("0");

                    }
                    if (workPeriod % 6 == 5 && workPeriod != 0) {
                        System.out.print("|");
                    }
                }
                System.out.print(myModelInitialSchedules.workingPeriodsPerFullTimeEmployees[employee].getValue());
                System.out.println("");
                fullTimeemployeeNo++;
            }
        }
        System.out.print("Working Employees    ");
        for (int workPeriod = 0; workPeriod < myScheduleParameters.workPeriodsPerSchedule; workPeriod++) {
            System.out.print(myModelInitialSchedules.employeesPerWorkPeriods[workPeriod].getValue());
            if (workPeriod % 6 == 5 && workPeriod != 0) {
                System.out.print("|");
            }
        }
        System.out.println("");
        System.out.print("Required Workforce   ");
        for (int workPeriod = 0; workPeriod < myScheduleParameters.workPeriodsPerSchedule; workPeriod++) {
            System.out.print(myScheduleParameters.requiredWorkforce[workPeriod]);
            if (workPeriod % 6 == 5 && workPeriod != 0) {
                System.out.print("|");
            }
        }
        System.out.println("");

    }

}
