{
  "$schema" : "https://json-schema.org/draft/2019-09/schema#",
  "$id" : "https://purl.imsglobal.org/spec/eduapiGradebook/v1p0/schema/json/eduapiGradebook_v1p0_lineitem-jsonschema1.json",
  "title" : "JSON Schema for the LineItem class.",
  "description" : "A line item defines what a reported score or grade is for. It may reference a specific graded activity or represent a summary grade such as a midterm or final. It does not define the activity itself, but serves as the mechanism for associating results to it.",
  "type" : "object",
  "properties" : {
    "sourcedId" : {
      "description" : "The sourcedId of the object. This is the interoperability identifier that systems will refer to when making API calls, or when needing to identify an object. Systems SHOULD be able to map whichever local ids (e.g. database key fields) they use to sourcedId. The sourcedId of an object MUST be an anonymized or pseudonymized identifier of an entity and as such will not contain Personally Identifiable Information (PII) or Personal Data (PD).",
      "$comment" : "Origin: GUID (DerivedType); The data-type for establishing a Globally Unique Identifier (GUID). There is no predefined structure for the GUID.",
      "type" : "string"
    },
    "recordLanguage" : {
      "description" : "The primary language used in the described entity.",
      "$comment" : "Origin: LanguageCode (DerivedType); A language code [[BCP47]].",
      "type" : "string",
      "pattern" : "^[a-z]{2,4}(-[A-Z][a-z]{3})?(-([A-Z]{2}|[0-9]{3}))?$"
    },
    "recordStatus" : {
      "description" : "The status of this record. The record has been, or will immediately be, removed from the upstream system; downstream systems can also remove this record as it won't be used again.",
      "$comment" : "Origin: RecordStatusTypeEnum (Enum); The set of values to describe the state of a record in the source system. For systems migrating from, or making use of OneRoster, deleted is to be considered synonymous with toBeDeleted.",
      "type" : "string",
      "enum" : [ "active", "deleted", "inactive" ]
    },
    "dateLastModified" : {
      "description" : "A timestamp describing when this record was last modified.",
      "$comment" : "Origin: DateTimeZ (DerivedType); A `DateTime` with the trailing timezone specifier included, e.g. `2021-09-07T02:09:59+02:00`",
      "type" : "string",
      "format" : "date-time"
    },
    "extensions" : {
      "$ref" : "#/$defs/lineItemExtensions"
    },
    "title" : {
      "type" : "array",
      "minItems" : 1,
      "items" : {
        "$ref" : "#/$defs/LanguageTypedString"
      }
    },
    "description" : {
      "$ref" : "#/$defs/LanguageTypedString"
    },
    "lineItemType" : {
      "description" : "This is used to differentiate between items used for recording assignment-level grades versus summary-level grades such as midterm and final.",
      "$comment" : "Origin: LineItemTypeEnum (EnumExt); The vocabulary for the permitted set of tokens for the type of a lineitem.",
      "oneOf" : [ {
        "type" : "string",
        "enum" : [ "activity", "midterm", "final", "current", "assessment" ]
      }, {
        "type" : "string",
        "pattern" : "(ext:)[a-z|A-Z|0-9|.|-|_]+"
      } ]
    },
    "assignDate" : {
      "description" : "The date/time the activity addressed by the LineItem was assigned to the student. Required when lineItemType is not 'assessment'; otherwise omitted. This uses the dateTime format defined in [ISO 8601].",
      "$comment" : "Origin: DateTime (PrimitiveType); An [[ISO8601]] time using the syntax YYYY-MM-DDThh:mm:ss.",
      "type" : "string",
      "format" : "date-time"
    },
    "dueDate" : {
      "description" : "The date/time by which the assignment must be completed and submitted. Required when lineItemType is not 'assessment'; otherwise omitted. This uses the dateTime format defined in [ISO 8601].",
      "$comment" : "Origin: DateTime (PrimitiveType); An [[ISO8601]] time using the syntax YYYY-MM-DDThh:mm:ss.",
      "type" : "string",
      "format" : "date-time"
    },
    "education" : {
      "description" : "A reference to an Edu-API education. This may be an offering or a template. Please refer to the educationType attribute to determine the type. Required when lineItemType is not 'assessment'; otherwise omitted.",
      "$comment" : "Origin: EducationGUIDRef (DerivedType); A reference to an `Education` object that has an allocated sourcedId (`GUID`). This education might be a template or an offering, this will be indicated by the companion educationType attribute",
      "type" : "string"
    },
    "educationType" : {
      "description" : "Identifies the type of education entity referenced, allowing the consumer to determine the appropriate endpoint for retrieving the associated education details. Required when lineItemType is not 'assessment'; otherwise omitted.",
      "$comment" : "Origin: EducationTypeEnum (EnumExt); Identifies the type of education entity referenced, allowing the consumer to determine the appropriate endpoint for retrieving the associated education details.",
      "oneOf" : [ {
        "type" : "string",
        "enum" : [ "collection", "course", "component", "collectionOffering", "courseOffering", "componentOffering" ]
      }, {
        "type" : "string",
        "pattern" : "(ext:)[a-z|A-Z|0-9|.|-|_]+"
      } ]
    },
    "organization" : {
      "description" : "The GUID of the organization for whom the lineItem has been assigned.",
      "$comment" : "Origin: OrganizationGUIDRef (DerivedType); A reference to an `Organization` object that has an allocated sourcedId (`GUID`).",
      "type" : "string"
    },
    "category" : {
      "description" : "The GUID of the Category to which the LineItem is assigned. This property is used for category-based organization and weighting. It SHOULD be provided when the lineItemType is 'activity'. This property is OPTIONAL when the lineItemType is 'assessment'.",
      "$comment" : "Origin: CategoryGUIDRef (DerivedType); A reference to a `Category` object that has an allocated sourcedId (`GUID`).",
      "type" : "string"
    },
    "gradingPeriod" : {
      "description" : "The GUID of the grading period for the lineItem.",
      "$comment" : "Origin: AcademicSessionGUIDRef (DerivedType); A reference to an `AcademicSession` object that has an allocated sourcedId (`GUID`).",
      "type" : "string"
    },
    "academicSession" : {
      "description" : "The GUID of the academic session for the lineItem. This should NOT be defined if the 'gradingPeriod' attribute has been used.",
      "$comment" : "Origin: AcademicSessionGUIDRef (DerivedType); A reference to an `AcademicSession` object that has an allocated sourcedId (`GUID`).",
      "type" : "string"
    },
    "scoreScale" : {
      "description" : "The GUID of the score scale to be used for the lineItem.",
      "$comment" : "Origin: ScoreScaleGUIDRef (DerivedType); A reference to a `ScoreScale` object that has an allocated sourcedId (`GUID`).",
      "type" : "string"
    },
    "resultValueMin" : {
      "description" : "The minimum value (numeric) that can be assigned to the score attribute in a result. The score scale mapping should be used to map to other scores.",
      "$comment" : "Origin: Float (PrimitiveType)",
      "type" : "number"
    },
    "resultValueMax" : {
      "description" : "The maximum value (numeric) that can be assigned to the score attribute in a result. The score scale mapping should be used to map to other scores.",
      "$comment" : "Origin: Float (PrimitiveType)",
      "type" : "number"
    },
    "learningObjectiveSet" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/$defs/LearningObjectiveSet"
      }
    },
    "parentLineItem" : {
      "description" : "A reference to another Edu-API LineItem. This allows for the building of assessment hierarchies. This property is only available when lineItemType is 'assessment'.",
      "$comment" : "Origin: LineItemGUIDRef (DerivedType); A reference to a `LineItem` object that has an allocated sourcedId (`GUID`).",
      "type" : "string"
    }
  },
  "required" : [ "sourcedId", "recordLanguage", "recordStatus", "title", "lineItemType", "organization" ],
  "additionalProperties" : false,
  "$defs" : {
    "LanguageTypedString" : {
      "description" : "A String with an associated language code.",
      "type" : "object",
      "properties" : {
        "recordLanguage" : {
          "description" : "The primary language used in the described entity.",
          "$comment" : "Origin: LanguageCode (DerivedType); A language code [[BCP47]].",
          "type" : "string",
          "pattern" : "^[a-z]{2,4}(-[A-Z][a-z]{3})?(-([A-Z]{2}|[0-9]{3}))?$"
        },
        "value" : {
          "description" : "The string value.",
          "$comment" : "Origin: String (PrimitiveType); Character strings.",
          "type" : "string"
        }
      },
      "required" : [ "recordLanguage", "value" ],
      "additionalProperties" : false
    },
    "lineItemExtensions" : {
      "description" : "Extension properties related to line items",
      "type" : "object",
      "properties" : { },
      "required" : [ ],
      "additionalProperties" : true
    },
    "LearningObjectiveSet" : {
      "description" : "This is the container for the set of learning objective identifiers that are from a single source responsible for creating those identifiers.",
      "type" : "object",
      "properties" : {
        "sourcedId" : {
          "description" : "The sourcedId of the object. This is the interoperability identifier that systems will refer to when making API calls, or when needing to identify an object. Systems SHOULD be able to map whichever local ids (e.g. database key fields) they use to sourcedId. The sourcedId of an object MUST be an anonymized or pseudonymized identifier of an entity and as such will not contain Personally Identifiable Information (PII) or Personal Data (PD).",
          "$comment" : "Origin: GUID (DerivedType); The data-type for establishing a Globally Unique Identifier (GUID). There is no predefined structure for the GUID.",
          "type" : "string"
        },
        "recordLanguage" : {
          "description" : "The primary language used in the described entity.",
          "$comment" : "Origin: LanguageCode (DerivedType); A language code [[BCP47]].",
          "type" : "string",
          "pattern" : "^[a-z]{2,4}(-[A-Z][a-z]{3})?(-([A-Z]{2}|[0-9]{3}))?$"
        },
        "recordStatus" : {
          "description" : "The status of this record. The record has been, or will immediately be, removed from the upstream system; downstream systems can also remove this record as it won't be used again.",
          "$comment" : "Origin: RecordStatusTypeEnum (Enum); The set of values to describe the state of a record in the source system. For systems migrating from, or making use of OneRoster, deleted is to be considered synonymous with toBeDeleted.",
          "type" : "string",
          "enum" : [ "active", "deleted", "inactive" ]
        },
        "dateLastModified" : {
          "description" : "A timestamp describing when this record was last modified.",
          "$comment" : "Origin: DateTimeZ (DerivedType); A `DateTime` with the trailing timezone specifier included, e.g. `2021-09-07T02:09:59+02:00`",
          "type" : "string",
          "format" : "date-time"
        },
        "extensions" : {
          "$ref" : "#/$defs/learningObjectiveSetExtensions"
        },
        "source" : {
          "description" : "The source responsible for creating the learning objective identifiers. The permitted values are from an extensible vocabulary.",
          "$comment" : "Origin: SourceExtEnum (EnumExt); The predefined vocabulary for the source that was responsible for creating the learning objective identifiers.",
          "oneOf" : [ {
            "type" : "string",
            "enum" : [ "case", "unknown", "CTDL-ASN" ]
          }, {
            "type" : "string",
            "pattern" : "(ext:)[a-z|A-Z|0-9|.|-|_]+"
          } ]
        },
        "learningObjectiveIds" : {
          "type" : "array",
          "minItems" : 1,
          "items" : {
            "description" : "The set of unique identifiers for the associated learning objectives. If these are CASE identifiers they MUST be valid UUIDs.",
            "$comment" : "Origin: NormalizedString (PrimitiveType); A `String` conforming to the `normalizedString` definition in [[XMLSCHEMA11-2]].",
            "type" : "string"
          }
        }
      },
      "required" : [ "sourcedId", "recordLanguage", "recordStatus", "source", "learningObjectiveIds" ],
      "additionalProperties" : false
    },
    "learningObjectiveSetExtensions" : {
      "description" : "Extension properties related Learning Objective Sets",
      "type" : "object",
      "properties" : { },
      "required" : [ ],
      "additionalProperties" : true
    }
  }
}