object Red
    description: (* The color red, used for F grades. *);
end Red;
object Orange
    description: (* The color orange, used for D grades. *);
end Orange;
object Purple
    description: (* The color purple, used for C grades. *);
end Purple;
object Blue
    description: (* The color blue, used for B grades. *);
end Blue;
object Green
    description: (* The color green, used for A grades. *);
end Green;

object Color
    components: Red or Orange or Purple or Blue or Green;
    description: (* A color in the color scheme used for coloring scores, final grades, and graphs. Each letter grade (A, B, C, D, F) gets a different color. *);
end Color;

object ColorCodingNone
    description: (* All grades are colored black. *);
end ColorCodingNone;
object ColorCodingFinal
    description: (* All grades that are not the final grade are colored black. The final grade is colored by percentage. *);
end ColorCodingFinal;
object ColorCodingAll
    description: (* All grades are colored by percentage. *);
end ColorCodingAll;

object ColorCoding
    components: ColorCodingNone or ColorCodingFinal or ColorCodingAll;
    description: (* The color coding preference: color all scores, just the final grades, or just the graphs. *);
end ColorCoding;

object NoLatePolicy
    description: (* If an assignemnt is turned in after its due date, it will recieve no credit.*);
end NoLatePolicy;
object LinearLatePolicy
    description: (* If an assignment is turned in late, the total credit the student can receive will decay linearly. *);
end LinearLatePolicy;
object ExponentialLatePolicy
    description: (* If an assignment is turned in late, the total credit the student can receive will decay exponentially. *);
end ExponentialLatePolicy;

object LatePolicy
    components: NoLatePolicy or LinearLatePolicy or ExponentialLatePolicy;
    description: (* The late policy: none, linear, or exponential. *);
end LatePolicy;

object NoWeight
    description: (* The points from this assignment are directly added to the total for the category. *);
end NoWeight;
object CategoryWeight
    description: (* The percentage a student recieves for this item is the percentage that the student recieves of the assigned percent of the overall category. I.e. if a student gets 100% on a CategoryWeight item, and that item is assigned to be 25% of its category, then the students gets 25% in that category. *);
end CategoryWeight;
object ClassWeight
    description: (* This item is worth a percentage of the overall class grade. *);
end ClassWeight;

object Weight
    components: NoWeight or CategoryWeight or ClassWeight;
    description: (* The type of weighted grading: none, percent of the category, or percent of the class. *);
end Weight;

object TraditionalScheme
    description: (* Graded as usual. *);
end TraditionalScheme;
object ProgressiveScheme
    description: (* If this category's items have monotonically increasing grades, the highest grade is substituted for the previous items' grades. *);
end ProgressiveScheme;
object MaximumScheme
    description: (* The highest grade in the category is used as the grade for all graded items. *);
end MaximumScheme;
object DropLowestScheme
    description: (* The lowest score in this category is discounted when calculating the score for the overall category. *);
end DropLowestScheme;

object GradingScheme
    components: TraditionalScheme or ProgressiveScheme or MaximumScheme or DropLowestScheme;
    description: (* The grading scheme for a category: traditional, progressive, maximum, or drop lowest. *);
end GradingScheme;

object NormalCredit
    description: (* Not an extra credit assignment. *);
end NormalCredit;
object ExtraCreditAddPoints
    description: (* Add the given number of points to the target assignment. *);
end ExtraCreditAddPoints;
object ExtraCreditAddPercent
    description: (* Add the given percentage to the percentage of the target assignment. *);
end ExtraCreditAddPercent;
object ExtraCreditBtoA
    description: (* Raise the target assignment by a full grade if extra credit is completed. *);
end ExtraCreditBtoA;
object ExtraCreditBtoBPlus
    description: (* Raise the target assignment by half a grade if extra credit is completed. *);
end ExtraCreditBtoBPlus;

object CreditType
    components: NormalCredit or ExtraCreditAddPoints or ExtraCreditAddPercent or ExtraCreditBtoA or ExtraCreditBtoBPlus;
    description: (* The type of extra credit: not extra credit, add points, add percentage, or increase final grade. *);
end CreditType;

object FirstName
    description: (* Sort students by first name with the first name that comes first alphabetically at the top. *);
end FirstName;
object LastName
    description: (* Sort students by last name with the last name that comes first alphabetically at the top. *);
end LastName;
object IdNumber
    description: (* Sort students by IdNumber, with the lowest IdNumber at the top. *);
end IdNumber;
object ItemSort
    description: (* Sort students by the scores of the given item. The highest score on top. *);
end ItemSort;
object FinalGrade
    description: (* Sort students by the scores of the final grade. The highest score on top. *);
end FinalGrade;

object SortedBy
    components:
        FirstName or
        LastName or
        IdNumber or
        ItemSort or
        FinalGrade;
   description: (* The order in which students will be rendered. *);
end SortedBy;

object EasyGrader
    components:
        gradebooks:Gradebook* and 
        preferences:ApplicationPreferences and
        clipboard:string and
        findString:string;
    description: (* The root of all components. *);
end EasyGrader;

object Gradebook
    components:
        sections:Section* and
        items:Item* and
        FinalGrade:Item and
        name:string  and
        filename:string and
        sortedBy:SortedBy and
        sortedByItem:Item and
        curve:Thresholds and
        userCredentials:Credentials and
        preferences:GradebookPreferences and
        graphs:Graphs and
        fileOnDisk: integer and
        predictionMode: boolean and
        history: ActionHistory;
    description: (* A gradebook for a class; a collection of students, items, and scores. *);
end Gradebook;

object ActionHistory
    components:
        next:Gradebook and
        prev:Gradebook;
     description: (* An undoable state of a gradebook. *);
end ActionHistory;

object Section
    components:
        sectionNumber:integer and
        groups:Group* and
        students:Student*;
    description: (* A section of a class. *);
end Section;

object Group
    components:
        name:string and
        students:Student* and
        selected:boolean and
        collapsed:boolean;
    description: (* A team of students. *);
end Group;

object Student
    components:
        firstName:string and
        lastName:string  and
        idNumber:integer and
        emplId:integer and
        loginId:string and
        email:string and
        classStanding:integer and
        scores:Score* and
        selected:boolean;
    description: (* A student on a class's roster. *);
end Student;

object Score
    components:
        pointsEarned:integer and
        turnInDate:Date and
        pointsEarnedPredicted:integer and
        turnInDatePredicted:Date  and
        associatedItem:Item;
    description: (* A specific student's raw score on a specific graded item. *);
end Score;

object Date
    components:
        year:integer and
        month: integer and
        day: integer and
        hour: integer and
        minute: integer;
    description: (* A date and time. *);
end Date;
    

object Item
    components:
        name:string and
        dueDate:Date and
        gracePeriod:integer and
        gracePeriodInherit:boolean and
        latePolicy: LatePolicy and
        latePolicyValue:real and
        latePolicyInherit:boolean and
        pointsPossible:integer  and
        pointsPossibleInherit:boolean and
        weight:Weight and
        weightPercent:real and
        weightInherit:boolean and
        gradingScheme:GradingScheme and
        gradingSchemeInherit:boolean and
        extraCredit:CreditType and
        extraCreditFor:Item and
        extraCreditInherit:boolean and
        children:Item* and
        selected:boolean and
        hidden:boolean and
        collapsed:boolean;
    description: (* A column in the gradebook, representing a category of other items, an assignment, a test, or some other graded item. *);
end Item;

object Thresholds
    components:
        ap_aThreshold: real and
        a_amThreshold: real and
        am_bpThreshold: real and
        bp_bThreshold: real and
        b_bmThreshold: real and
        bm_cpThreshold: real and
        cp_cThreshold: real and
        c_cmThreshold: real and
        cm_dpThreshold: real and
        dp_dThreshold: real and
        d_dmThreshold: real and
        dm_fThreshold: real;
    description: (* A set of percentages dividing a percentage grade into letter grades. *);
end Thresholds;

object Graphs
    components:
        name:string and
        histogram:Histogram and
        pieChart:PieChart and
        curve:Thresholds;
    description: (* The object containing all graphical representations of grade distribution. *);
end Graphs;

object Histogram
    components:
        Name:string and
        stars:HistogramBar*;
   description: (* The histogram graph. *);
end Histogram;

object HistogramBar
    components:
        percentage:real and
        numberOfScores:integer and
        color:Color;
    description: (* A single bar on the histogram. *);
end HistogramBar;

object PieChart
    components:
        slices:PieSlice*;
    description: (* The pie chart graph. *);
end PieChart;

object PieSlice
    components:
        percentage:real and
        numberOfScores:integer and
        color:Color;
    description: (* A single slice of the pie chart. *);
end PieSlice;

object Credentials
    components:
        server:string and
        userName:string and
        password:string;
    description: (* Information needed to authenticate a user against an external server. *);
end Credentials;

object ApplicationPreferences
    components:
        showToolbar:boolean and
        colorCoding:ColorCoding;
    description: (* User preferences specific to the Easy Grader application. *);
end ApplicationPreferences;

object PageSetup
    description: (* An operating system-specific data structure describing settings used for printing. *);
end PageSetup;

object GradebookPreferences
    components:
        pageSetup:PageSetup and
        showGroups:boolean;
    description: (* User preferences specific to a gradebook. *);
end GradebookPreferences;

object ItemExplorer
    components:
        items:Item * ;
    description: (* The Item Explorer view of a gradebook's items. *);
end ItemExplorer;