{
  "$schema" : "https://json-schema.org/draft/2019-09/schema#",
  "$id" : "https://purl.imsglobal.org/spec/orrostering/v1p2/schema/json/orrostering_v1p2_userset-jsonschema1.json",
  "title" : "JSON Schema for the UserSet class.",
  "description" : "This is the container for a collection of user 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" : {
    "users" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/$defs/User"
      }
    }
  },
  "required" : [ ],
  "additionalProperties" : false,
  "$defs" : {
    "User" : {
      "description" : "Users, Teachers and Students are human beings that are teaching or studying in a class respectively. A single User class is used to represent both teachers and students and a role property is used to distinguish a user's natural role.Humans may have relationships with other humans. For example, a student may have parents. The 'agents' attribute allows for relationships between humans to be expressed. Note that these are typically from the point of view of the student - so a student will link to its parents (via the agent attribute). The reverse view MUST also be modeled, so for example, a user of role 'parent' MUST have agents that are of type 'student'. Note: Teachers MUST NOT be set as agents of students i.e. the teaching relationship is covered via enrollments. ",
      "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"
        },
        "userMasterIdentifier" : {
          "description" : "The master unique identifier for this user. This is NOT the same as the user's interoperability 'sourcedId'. This should be used to ensure that all of the system identifiers/accounts etc. can be reconciled to the same user. How this identifier is assigned and its format is beyond the scope of this specification.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "username" : {
          "description" : "The user name assigned to the user. NOTE - This has been kept for backwards compatibility with OneRoster 1.1 and the new 'userProfiles' characteristic SHOULD be used instead.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "userIds" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/$defs/UserId"
          }
        },
        "enabledUser" : {
          "description" : "This is used to determine whether or not the record is active in the local system. 'false' denotes that the record is active but system access is curtailed according to the local administration rules.",
          "$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" ]
        },
        "givenName" : {
          "description" : "The given name. Also, known as the first name.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "familyName" : {
          "description" : "The family name. Also, known as the last name.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "middleName" : {
          "description" : "The set of middle names. If more than one middle name is needed separate using a space e.g. 'Wingarde Granville'.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "preferredFirstName" : {
          "description" : "The user's preferred first name. This attribute was added in version 1.2.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "preferredMiddleName" : {
          "description" : "The user's preferred middle name(s). This attribute was added in version 1.2.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "preferredLastName" : {
          "description" : "The user's preferred last name. This attribute was added in version 1.2.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "pronouns" : {
          "description" : "The pronoun(s) by which this person is referenced. Examples (in the case of English) include 'she/her/hers', 'he/him/his', 'they/them/theirs', 'ze/hir/hir', 'xe/xir', or a statement that the person's name should be used instead of any pronoun.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "roles" : {
          "type" : "array",
          "minItems" : 1,
          "items" : {
            "$ref" : "#/$defs/Role"
          }
        },
        "userProfiles" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/$defs/UserProfile"
          }
        },
        "primaryOrg" : {
          "$ref" : "#/$defs/OrgGUIDRef"
        },
        "identifier" : {
          "description" : "An identifier for the user. NOTE - This characteristic is kept for backwards compatibility with OneRoster 1.1/1.0. The 'userIds' characteristic SHOULD be used instead.",
          "$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"
        },
        "email" : {
          "description" : "The email address for the user.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "sms" : {
          "description" : "The SMS number for the user.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "phone" : {
          "description" : "The phone number for the user.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "agents" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/$defs/UserGUIDRef"
          }
        },
        "grades" : {
          "type" : "array",
          "items" : {
            "description" : "Grade(s) for which a user with role 'student' is enrolled. 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"
          }
        },
        "password" : {
          "description" : "A top-level password for the user. Care should be taken when using this field and the password SHOULD be encrypted.",
          "$comment" : "Origin: String (PrimitiveType)",
          "type" : "string"
        },
        "resources" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/$defs/ResourceGUIDRef"
          }
        },
        "metadata" : {
          "$ref" : "#/$defs/MetadataUser"
        }
      },
      "required" : [ "sourcedId", "status", "dateLastModified", "enabledUser", "givenName", "familyName", "roles" ],
      "additionalProperties" : false
    },
    "UserProfile" : {
      "description" : "The container for the information about a User Profile that will provide the user with access to some system, application, tool, etc.",
      "type" : "object",
      "properties" : {
        "profileId" : {
          "description" : "The unique identifier for the profile. This does not need to be a globally unique identifier but it must be unique within the scope of the user.",
          "$comment" : "Origin: AnyURI (PrimitiveType)",
          "type" : "string"
        },
        "profileType" : {
          "description" : "The type of profile. This should be a human readable label that has some significance in the context of the related system, app, tool, etc.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "vendorId" : {
          "description" : "The unique identifier for the vendor of the system, tool, app, etc. which requires the use of this profile.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "applicationId" : {
          "description" : "Identifier for the application associated with the account. The nature, and how this identifier is assigned is not defined by this specification. This may have a value of 'default' to denote this account should be used for default access to all applications related to this vendor.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "description" : {
          "description" : "A human readable description of the use of the profile. This should not contain any security information for access to the account.",
          "$comment" : "Origin: String (PrimitiveType)",
          "type" : "string"
        },
        "credentials" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/$defs/Credential"
          }
        }
      },
      "required" : [ "profileId", "profileType", "vendorId" ],
      "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
    },
    "MetadataUser" : {
      "description" : "The container for the proprietary extensions in the User class.",
      "type" : "object",
      "properties" : { },
      "required" : [ ],
      "additionalProperties" : true
    },
    "Role" : {
      "description" : "The container for one mapping between a role and an org for the user.",
      "type" : "object",
      "properties" : {
        "roleType" : {
          "description" : "Indicates if this role is the primary or secondary role for that org. There MUST be one, and only one, primary role for each org.",
          "$comment" : "Origin: RoleTypeEnum (Enumeration); The type of role for the role-org mappings. Each mapping must have a role type of which only one must have a roleType of 'primary' and the others must be 'secondary'. ",
          "type" : "string",
          "enum" : [ "primary", "secondary" ]
        },
        "role" : {
          "description" : "The role of the user in the org. The permitted values are from an enumerated list. ",
          "$comment" : "Origin: RoleEnumExt (Union); The data-type for the 'role' characteristic for a user. This is an extensible enumerated vocabulary. Extending the vocabulary makes use of a naming convention.",
          "oneOf" : [ {
            "type" : "string",
            "enum" : [ "aide", "counselor", "districtAdministrator", "guardian", "parent", "principal", "proctor", "relative", "siteAdministrator", "student", "systemAdministrator", "teacher" ]
          }, {
            "type" : "string",
            "pattern" : "(ext:)[a-zA-Z0-9\\.\\-_]+"
          } ]
        },
        "org" : {
          "$ref" : "#/$defs/OrgGUIDRef"
        },
        "userProfile" : {
          "description" : "The identifier for the system/tool/app access account that is relevant to this role in the org. The equivalent UserProfile should exist with a 'profileId' equal to this identifier value.",
          "$comment" : "Origin: AnyURI (PrimitiveType)",
          "type" : "string"
        },
        "beginDate" : {
          "description" : "The start date on which the role becomes active (inclusive). ",
          "$comment" : "Origin: Date (PrimitiveType)",
          "type" : "string",
          "format" : "date"
        },
        "endDate" : {
          "description" : "The end date on which the role becomes inactive (exclusive). ",
          "$comment" : "Origin: Date (PrimitiveType)",
          "type" : "string",
          "format" : "date"
        }
      },
      "required" : [ "roleType", "role", "org" ],
      "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
    },
    "UserId" : {
      "description" : "This is the set of external user identifiers that should be used for this user, if for some reason the sourcedId cannot be used. This might be an active directory id, an LTI id, or some other machine-readable identifier that is used for this person.",
      "type" : "object",
      "properties" : {
        "type" : {
          "description" : "The type of identifier. This is no predefined vocabulary.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "identifier" : {
          "description" : "The user identifier.",
          "$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"
        }
      },
      "required" : [ "type", "identifier" ],
      "additionalProperties" : false
    },
    "Credential" : {
      "description" : "The container for a single set of credentials for an account.",
      "type" : "object",
      "properties" : {
        "type" : {
          "description" : "The type of credentials for the profile. This should be indicative of when this specific credential should be used.",
          "$comment" : "Origin: String (PrimitiveType)",
          "type" : "string"
        },
        "username" : {
          "description" : "The username.",
          "$comment" : "Origin: NormalizedString (PrimitiveType)",
          "type" : "string"
        },
        "password" : {
          "description" : "The password in this set of credentials.  Care should be taken to ensure that no unencrypted value is revealed.",
          "$comment" : "Origin: String (PrimitiveType)",
          "type" : "string"
        }
      },
      "required" : [ "type", "username" ],
      "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
    }
  }
}