package database;
import java.util.Collection;

/**
 * This class contains important metadata about schedules.
 * Each schedule will contain a collection of courses, as well as an associated name.
 * An enum for quarter ensures that this field is consistent.
 * For modeling purposes, this class contains a copy of the entire database for each
 * different schedule.
 * @author jroll
 *
 */
public abstract class Schedule extends DataItem {
	public enum Quarter {FALL, WINTER, SPRING, SUMMER};
	public Quarter quarter;
	public boolean published;
	public int year;
	public String name;
  public Database copyOfDatabase;
  public boolean generated;
	
	public Collection<Course> courses;


/**
* Insert the course record into the courses collection.
*/

/*@
ensures
//
// A course record is in the courses collection if and only if it is the new
// record to be added or it is in the input collection.
//
(\forall Course cr_other ;
	courses.contains(cr_other) <==>
        	cr_other.equals(course) || \old(courses).contains(cr_other));
@*/

	public abstract void insertCourse(Course course);
	
/**
* Delete the given group record from the given GroupDB.  The given record
* must already be in the input db.  Typically the user runs the FindGroup
* operation prior to Delete to locate an existing record to delete.
*/
     
/*@
  requires
  //
  // The given course record is in the given courses collection.
  //
  courses.contains(course);

  ensures
  //
  // A course record is in the courses collection if and only if it is not the
  // existing record to be deleted and it is in the input collection.
  //
  (\forall Course course_other ;
            courses.contains(course_other) <==>
                !course_other.equals(course) && \old(courses).contains(course_other));
@*/

   public abstract void removeCourse(Course course);
	
/*@
  requires
  //
  // The schedule has not been published yet.
  //
  this.published == false;

  ensures
  //
  // the schedule has been published.
  //
  this.published == true;
@*/

   public abstract void publishSchedule();
}