{
  "$schema" : "https://json-schema.org/draft/2019-09/schema#",
  "$id" : "https://purl.imsglobal.org/spec/orrostering/v1p2/schema/json/orrostering_v1p2_orgset-jsonschema1.json",
  "title" : "JSON Schema for the OrgSet class.",
  "description" : "This is the container for a collection of org instances for a message payload. This may be empty if no instances are found that sustain the applied query constraints. The order is not significant.",
  "type" : "object",
  "properties" : {
    "orgs" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/$defs/Org"
      }
    }
  },
  "required" : [ ],
  "additionalProperties" : false,
  "$defs" : {
    "Org" : {
      "description" : "ORG is defined here as a structure for holding organizational information. An ORG might be a school, or it might be a local, statewide, or national entity. ORGs will typically have a parent ORG (up to the national level), and children, allowing a hierarchy to be established. School is defined here as the place where the learning happens. Most commonly this is the data that describes a bricks and mortar building, or, in the case of a virtual school, the virtual school organization. For enrollment and result reporting purposes, little information about this organization is required. A common example of a local organization is a school district.",
      "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"
        },
        "name" : {
          "description" : "The name of the organization.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "type" : {
          "description" : "The type of organization. This uses a predefined vocabulary.",
          "$comment" : "Origin: OrgTypeEnumExt (Union); The data-type for the 'type' characteristic for an org. This is an extensible enumerated vocabulary. Extending the vocabulary makes use of a naming convention.",
          "oneOf" : [ {
            "type" : "string",
            "enum" : [ "department", "district", "local", "national", "school", "state" ]
          }, {
            "type" : "string",
            "pattern" : "(ext:)[a-zA-Z0-9\\.\\-_]+"
          } ]
        },
        "identifier" : {
          "description" : "Human readable identifier for this org e.g. NCES ID.",
          "$comment" : "Origin: Identifier (DerivedType); The data-type for a local unique identifier. The scope of the uniqueness of this identifier is determined by the organization assigning it.",
          "type" : "string"
        },
        "parent" : {
          "$ref" : "#/$defs/OrgGUIDRef"
        },
        "children" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/$defs/OrgGUIDRef"
          }
        },
        "metadata" : {
          "$ref" : "#/$defs/MetadataOrg"
        }
      },
      "required" : [ "sourcedId", "status", "dateLastModified", "name", "type" ],
      "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
    },
    "MetadataOrg" : {
      "description" : "The container for the proprietary extensions for the Org class.",
      "type" : "object",
      "properties" : { },
      "required" : [ ],
      "additionalProperties" : true
    }
  }
}