{
  "$schema" : "https://json-schema.org/draft/2019-09/schema#",
  "$id" : "https://purl.imsglobal.org/spec/orrostering/v1p2/schema/json/orrostering_v1p2_singleenrollment-jsonschema1.json",
  "title" : "JSON Schema for the SingleEnrollment class.",
  "description" : "This is the container for a single enrollment instance for a message payload.",
  "type" : "object",
  "properties" : {
    "enrollment" : {
      "$ref" : "#/$defs/Enrollment"
    }
  },
  "required" : [ "enrollment" ],
  "additionalProperties" : false,
  "$defs" : {
    "Enrollment" : {
      "description" : "An enrollment is the name given to an individual taking part in a class. In the vast majority of cases, users will be students learning in a class, or teachers teaching the class. Other roles are also possible.",
      "type" : "object",
      "properties" : {
        "sourcedId" : {
          "description" : "The sourcedId of the object. All objects MUST be identified by a Source Identifier. This is an interoperability System ID for an object. This is the identifier that SYSTEMS will refer to when making API calls, or when needing to identify an object. It is RECOMMENDED that systems are able to map whichever local ids (e.g. database key fields) they use to SourcedId. The sourcedId of an object is considered an addressable property of an entity and as such will not be treated as Personally Identifiable Information (PII) by certified products. Therefore, as a part of certification, vendors will be required to declare that they will notify customers via documentation or other formal and documented agreement that sourcedIds should never contain PII in general.",
          "$comment" : "Origin: SourcedId (DerivedType); The data-type for establishing a Unique Identifier. There is no predefined structure for the identifier and the scope MUST NOT assume globally uniqueness.",
          "type" : "string"
        },
        "status" : {
          "description" : "All objects MUST BE either 'active' or 'tobedeleted'. Something which is flagged 'tobedeleted' is to be considered safe to delete. Systems can delete records that are flagged as such if they wish, but they are not under any compulsion to do so. In v1.1 the enumeration value of 'inactive' was removed and so for backwards compatibility all such marked objects should be interpreted as 'tobedeleted'.",
          "$comment" : "Origin: BaseStatusEnum (Enumeration); The set of permitted values for the type of status of a record. ",
          "type" : "string",
          "enum" : [ "active", "tobedeleted" ]
        },
        "dateLastModified" : {
          "description" : "All objects MUST be annotated with the dateTime upon which they were last modified. This enables requesters to query for just the latest objects. DateTimes MUST be expressed in the format 'YYYY-MM-DDThh:mm:ss.sssZ' [ISO 8601].",
          "$comment" : "Origin: DateTime (PrimitiveType)",
          "type" : "string",
          "format" : "date-time"
        },
        "user" : {
          "$ref" : "#/$defs/UserGUIDRef"
        },
        "class" : {
          "$ref" : "#/$defs/ClassGUIDRef"
        },
        "school" : {
          "$ref" : "#/$defs/OrgGUIDRef"
        },
        "role" : {
          "description" : "The role of the user for this class in the school e.g teacher, student, etc. This is from an enumerated vocabulary.",
          "$comment" : "Origin: EnrolRoleEnumExt (Union); The data-type for the 'role' characteristic for an enrollment. This is an extensible enumerated vocabulary. Extending the vocabulary makes use of a naming convention.",
          "oneOf" : [ {
            "type" : "string",
            "enum" : [ "administrator", "proctor", "student", "teacher" ]
          }, {
            "type" : "string",
            "pattern" : "(ext:)[a-zA-Z0-9\\.\\-_]+"
          } ]
        },
        "primary" : {
          "description" : "Applicable only to teachers. Only one teacher should be designated as the primary teacher for a class (this value set as 'true') in the period defined by the begin/end dates.",
          "$comment" : "Origin: TrueFalseEnum (Enumeration); This enumeration is used to limit the permitted tokens for a Boolean data-type to values of 'true' or 'false' ONLY.",
          "type" : "string",
          "enum" : [ "true", "false" ]
        },
        "beginDate" : {
          "description" : "The start date for the enrollment (inclusive). This date must be within the period of the associated Academic Session for the class (Term/Semester/SchoolYear). Use the [ISO 8601] format of 'YYYY-MM-DD'.",
          "$comment" : "Origin: Date (PrimitiveType)",
          "type" : "string",
          "format" : "date"
        },
        "endDate" : {
          "description" : "The end date for the enrollment (exclusive).  This date must be within the period of the associated Academic Session for the class (Term/Semester/SchoolYear). Use the [ISO 8601] format of 'YYYY-MM-DD'.",
          "$comment" : "Origin: Date (PrimitiveType)",
          "type" : "string",
          "format" : "date"
        },
        "metadata" : {
          "$ref" : "#/$defs/MetadataEnrollment"
        }
      },
      "required" : [ "sourcedId", "status", "dateLastModified", "user", "class", "school", "role" ],
      "additionalProperties" : false
    },
    "OrgGUIDRef" : {
      "description" : "This is the container for reference to a OneRoster 'Org' object that has an allocated sourcedId (GUID).",
      "type" : "object",
      "properties" : {
        "type" : {
          "description" : "The type of object being referenced i.e. an 'org'.",
          "$comment" : "Origin: OrgGUIDRefTypeEnum (Enumeration); This is the fixed enumeration for a GUIDRef that points to an 'Org'.",
          "type" : "string",
          "enum" : [ "org" ]
        },
        "href" : {
          "description" : "The URI for the type of object being referenced.",
          "$comment" : "Origin: AnyURI (PrimitiveType)",
          "type" : "string"
        },
        "sourcedId" : {
          "description" : "The globally unique identifier of the object being referenced.",
          "$comment" : "Origin: SourcedId (DerivedType); The data-type for establishing a Unique Identifier. There is no predefined structure for the identifier and the scope MUST NOT assume globally uniqueness.",
          "type" : "string"
        }
      },
      "required" : [ "type", "href", "sourcedId" ],
      "additionalProperties" : false
    },
    "ClassGUIDRef" : {
      "description" : "This is the container for reference to a OneRoster 'Class' object that has an allocated sourcedId (GUID).",
      "type" : "object",
      "properties" : {
        "type" : {
          "description" : "The type of object being referenced i.e. a 'class'.",
          "$comment" : "Origin: ClassGUIDRefTypeEnum (Enumeration); This is the fixed enumeration for a GUIDRef that points to a 'Class'.",
          "type" : "string",
          "enum" : [ "class" ]
        },
        "href" : {
          "description" : "The URI for the type of object being referenced.",
          "$comment" : "Origin: AnyURI (PrimitiveType)",
          "type" : "string"
        },
        "sourcedId" : {
          "description" : "The globally unique identifier of the object being referenced.",
          "$comment" : "Origin: SourcedId (DerivedType); The data-type for establishing a Unique Identifier. There is no predefined structure for the identifier and the scope MUST NOT assume globally uniqueness.",
          "type" : "string"
        }
      },
      "required" : [ "type", "href", "sourcedId" ],
      "additionalProperties" : false
    },
    "MetadataEnrollment" : {
      "description" : "The container for the proprietary extensions in the Enrollment class.",
      "type" : "object",
      "properties" : { },
      "required" : [ ],
      "additionalProperties" : true
    },
    "UserGUIDRef" : {
      "description" : "This is the container for reference to a OneRoster 'User' object that has an allocated sourcedId (GUID).",
      "type" : "object",
      "properties" : {
        "type" : {
          "description" : "The type of object being referenced i.e. a 'user'.",
          "$comment" : "Origin: UserGUIDRefTypeEnum (Enumeration); This is the fixed enumeration for a GUIDRef that points to a 'User.",
          "type" : "string",
          "enum" : [ "user" ]
        },
        "href" : {
          "description" : "The URI for the type of object being referenced.",
          "$comment" : "Origin: AnyURI (PrimitiveType)",
          "type" : "string"
        },
        "sourcedId" : {
          "description" : "The globally unique identifier of the object being referenced.",
          "$comment" : "Origin: SourcedId (DerivedType); The data-type for establishing a Unique Identifier. There is no predefined structure for the identifier and the scope MUST NOT assume globally uniqueness.",
          "type" : "string"
        }
      },
      "required" : [ "type", "href", "sourcedId" ],
      "additionalProperties" : false
    }
  }
}