{
  "$schema" : "https://json-schema.org/draft/2019-09/schema#",
  "$id" : "https://purl.imsglobal.org/spec/orrostering/v1p2/schema/json/orrostering_v1p2_singleclass-jsonschema1.json",
  "title" : "JSON Schema for the SingleClass class.",
  "description" : "This is the container for a single class instance for a message payload.",
  "type" : "object",
  "properties" : {
    "class" : {
      "$ref" : "#/$defs/Class"
    }
  },
  "required" : [ "class" ],
  "additionalProperties" : false,
  "$defs" : {
    "Class" : {
      "description" : "A class is an instance of a course, onto which students and teachers are enrolled. A class is typically held within a term.",
      "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"
        },
        "title" : {
          "description" : "The tile/label for the class.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "classCode" : {
          "description" : "The class code.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "classType" : {
          "description" : "The type of class. This is based upon an enumerated vocabulary.",
          "$comment" : "Origin: ClassTypeEnumExt (Union); The data-type for the 'classType' characteristic for a class. This is an extensible enumerated vocabulary. Extending the vocabulary makes use of a naming convention.",
          "oneOf" : [ {
            "type" : "string",
            "enum" : [ "homeroom", "scheduled" ]
          }, {
            "type" : "string",
            "pattern" : "(ext:)[a-zA-Z0-9\\.\\-_]+"
          } ]
        },
        "location" : {
          "description" : "The location for the class e.g. 'Room 19'.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "grades" : {
          "type" : "array",
          "items" : {
            "description" : "The grade(s) who attend the class. The permitted vocabulary should be defined as part of the adoption and deployment process. See the Implementation Guide [OR-IMPL-12] for more details on how to define/use such a vocabulary.",
            "$comment" : "Origin: NormalizedString (PrimitiveType)",
            "type" : "string"
          }
        },
        "subjects" : {
          "type" : "array",
          "items" : {
            "description" : "The set of subjects addressed by this class e.g. 'chemistry'.",
            "$comment" : "Origin: NormalizedString (PrimitiveType)",
            "type" : "string"
          }
        },
        "course" : {
          "$ref" : "#/$defs/CourseGUIDRef"
        },
        "school" : {
          "$ref" : "#/$defs/OrgGUIDRef"
        },
        "terms" : {
          "type" : "array",
          "minItems" : 1,
          "items" : {
            "$ref" : "#/$defs/AcadSessionGUIDRef"
          }
        },
        "subjectCodes" : {
          "type" : "array",
          "items" : {
            "description" : "This is a machine readable set of codes and the number should match the associated 'subjects' attribute. The vocabulary for this characteristic should be defined as part of the local addition of this specification (see the Implementation Guide [OR-IMPL-12] for more details).",
            "$comment" : "Origin: NormalizedString (PrimitiveType)",
            "type" : "string"
          }
        },
        "periods" : {
          "type" : "array",
          "items" : {
            "description" : "The time slots in the day that the class will be given. Examples are 1 or a list of 1, 3, 5, etc.",
            "$comment" : "Origin: NormalizedString (PrimitiveType)",
            "type" : "string"
          }
        },
        "resources" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/$defs/ResourceGUIDRef"
          }
        },
        "metadata" : {
          "$ref" : "#/$defs/MetadataClass"
        }
      },
      "required" : [ "sourcedId", "status", "dateLastModified", "title", "classType", "course", "school", "terms" ],
      "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
    },
    "CourseGUIDRef" : {
      "description" : "This is the container for reference to a OneRoster 'Course' object that has an allocated sourcedId (GUID).",
      "type" : "object",
      "properties" : {
        "type" : {
          "description" : "The type of object being referenced i.e. a 'course'.",
          "$comment" : "Origin: CourseGUIDRefTypeEnum (Enumeration); This is the fixed enumeration for a GUIDRef that points to a 'Course'.",
          "type" : "string",
          "enum" : [ "course" ]
        },
        "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
    },
    "ResourceGUIDRef" : {
      "description" : "This is the container for reference to a OneRoster 'Resource' object that has an allocated sourcedId (GUID).",
      "type" : "object",
      "properties" : {
        "type" : {
          "description" : "The type of object being referenced i.e. a 'resource'.",
          "$comment" : "Origin: ResourceGUIDRefTypeEnum (Enumeration); This is the fixed enumeration for a GUIDRef that points to a 'Resource'.",
          "type" : "string",
          "enum" : [ "resource" ]
        },
        "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
    },
    "AcadSessionGUIDRef" : {
      "description" : "This is the container for reference to a OneRoster 'Academic Session' object that has an allocated sourcedId (GUID).",
      "type" : "object",
      "properties" : {
        "type" : {
          "description" : "The type of object being referenced i.e. an 'academicSession'.",
          "$comment" : "Origin: AcadSessionGUIDRefTypeEnum (Enumeration); This is the fixed enumeration for a GUIDRef that points to an 'Academic Session'.",
          "type" : "string",
          "enum" : [ "academicSession" ]
        },
        "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
    },
    "MetadataClass" : {
      "description" : "The container for the proprietary extensions in the Class class.",
      "type" : "object",
      "properties" : { },
      "required" : [ ],
      "additionalProperties" : true
    }
  }
}