package view;
import java.util.Collection;
import javax.swing.JPanel;
import javax.swing.JButton;

enum WeekDay {Monday, Tuesday, Wednesday, Thursday, Friday}

/**
 * represents the main container for the Schedule viewing screen
 * @author igood
 */
abstract class ScheduleView {
   JPanel mainWindow;
   JButton filters, listTab, courseTab, insTab, roomTab;
   ScheduleViewInterior currentInterior;
   Schedule currentSchedule;
}

/**
 * represents the basic setup of a Schedule view
 * @author igood
 */
abstract class ScheduleViewInterior {
   Collection<JPanel> scheduleGrid;
   Collection<Section> scheduleGridData;
   Filter viewFilter;
   
   /**
    * prints the current Schedule
    * @author igood
    */
   public abstract void print();
}

/**
 * represents the basic setup of the filter selection view
 * @author igood
 */
abstract class FilterTab extends ScheduleViewInterior {
   public Collection<Teacher> instructors;
   public Collection<Course> courses;
   public Collection<Room> rooms;
   
   /**
    * marks all elements in the collection as selected
    * @author igood
    */
   /*@
    ensures
      // all items in the colllection will have their isSelected field set to
      // true
      (\forall Teacher instructor; toMark.contains(instructor);
         instructor.isSelected == true);
    @*/
   public abstract void selectAllTeachers(Collection<Teacher> toMark);
   
   /**
    * marks all elements in the collection as selected
    * @author igood
    */
   /*@
    ensures
      // all items in the colllection will have their isSelected field set to
      // true
      (\forall Course courseId; toMark.contains(courseId);
         courseId.isSelected == true);
    @*/
   public abstract void selectAllCourses(Collection<Course> toMark);
   
   /**
    * marks all elements in the collection as selected
    * @author igood
    */
   /*@
    ensures
      // all items in the colllection will have their isSelected field set to
      // true
      (\forall Room courseRoom; toMark.contains(courseRoom);
         courseRoom.isSelected == true);
    @*/
   public abstract void selectAllRooms(Collection<Room> toMark);
   
   /**
    * marks all elements in the collection as not selected
    * @author igood
    */
   /*@
    ensures
      // all items in the colllection will have their isSelected field set to
      // false
      (\forall Teacher instructor; toMark.contains(instructor);
         instructor.isSelected == false);
    @*/
   public abstract void deSelectAllTeachers(Collection<Teacher> toMark);
   
   /**
    * marks all elements in the collection as not selected
    * @author igood
    */
   /*@
    ensures
      // all items in the colllection will have their isSelected field set to
      // false
      (\forall Course courseId; toMark.contains(courseId);
         courseId.isSelected == false);
    @*/
   public abstract void deSelectAllCourses(Collection<Course> toMark);
   
   /**
    * marks all elements in the collection as not selected
    * @author igood
    */
   /*@
    ensures
      // all items in the colllection will have their isSelected field set to
      // false
      (\forall Room courseRoom; toMark.contains(courseRoom);
         courseRoom.isSelected == false);
    @*/
   public abstract void deSelectAllRooms(Collection<Room> toMark);
}

/**
 * represents the view by course tab of the Schedule view
 * @author igood
 */
abstract class ByCourseTab extends ScheduleViewInterior {
   Collection<Course> courseSelect;
}

/**
 * represents the view by instructor tab of the Schedule view
 * @author igood
 */
abstract class ByInstructorTab extends ScheduleViewInterior {
   Collection<Teacher> instructorSelect;
}

/**
 * represents the view by room tab of the Schedule view
 * @author igood
 */
abstract class ByRoomTab extends ScheduleViewInterior {
   Collection<Building> buildingSelect;
   Collection<Room> roomSelect;
}

/**
 * represents the list view tab of the Schedule view
 * @author igood
 */
abstract class ListTab extends ScheduleViewInterior {
   Collection<Teacher> instructorSelect;
   Collection<Course> courseSelect;
   Collection<Room> roomSelect;
}

/**
 * represents a single section of a course
 * @author igood
 */
abstract class Section {
   Teacher courseInstructor;
   Room courseRoom;
   TimeBlock courseTime;
   Course courseId;
   Collection<WeekDay> days;
}

/**
 * represents a filter to be used to constrain what is
 * shown in the various view interfaces
 * @author igood
 */
abstract class Filter {
   Collection<Room> validRooms;
   Collection<Teacher> validTeachers;
   Collection<Course> validCourses;
}

/**
 * represents a blocked out time of day
 * using a startTime and endTime, in minutes since midnight
 * @author igood
 */
abstract class TimeBlock {
   int startTime;
   int endTime;
}

/**
 * represents a single room in a building
 * @author igood
 */
abstract class Room {
   public int buildingNumber;
   public int roomNumber;
   public boolean isSelected;
}

/**
 * represents a course instructor
 * @author igood
 */
abstract class Teacher {
   public String lastName;
   public String firstName;
   public boolean isSelected;
}

/**
 * represents a course to be taught
 * @author igood
 */
abstract class Course {
   public String courseId;
   public int courseNum;
   public boolean isSelected;
}

/**
 * represents a building
 * @author igood
 */
abstract class Building {
   String name;
   int buildingNumber;
}