package com.example.model;
import java.util.*;

/**
 * Purpose: Student class sets the availability of each student.
 * @author Jason Grafinger
 **/
public class Student {
   
    ////////
    // Data
    ////////
    private int[][] schedule;

    ///////
    // Methods
    ////////
   
    /**
     *
     * Purpose: Student constructor sets up the student to keep track of their availability.
     *
     **/
    public Student(){
        
        schedule = new int[5][9];
    
        for(int x = 0; x < 5; x++){
            for(int y = 0; y < 9; y++){
                schedule[x][y] = 0;
            }
        }
    }

    /**
     * Purpose: Checks to see if a particular day and hour are set free, which is represented by the number 1.
     * @param day Day of the week.
     * @param hour Hour of the Day.
     * @return either a 1 or 0 depending on availability.
     **/
    public int getFreeHour(int day, int hour){
	if(day >= 5 || hour >= 9)
	    {
		return -1;
	    }

        if(this.schedule[day][hour] == 1){
            return 1;
        }
        else{
            return 0;
        }
    }
    /**
     * Purpose: Sets a day and hour to be free for the student.  After checking valid array bounds, return a 1 for that
     * specific hour and day.
     *
     * @param day Day of the week.
     * @param hour Hour of the Day.
     **/

    public int setHourAsFree(int day, int hour){
	if(day >=5 || hour >= 9)
	    {
		return -1;
	    }

        schedule[day][hour] = 1;
        return 1;
    }
}
