<!--
		SIF Implementation Specification (New Zealand) 3.1
		(8 December, 2020
)
		
		Infrastructure Version: v3.1
	-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sifassociation.org/datamodel/nz/3.1" targetNamespace="http://www.sifassociation.org/datamodel/nz/3.1" elementFormDefault="qualified" version="3.1 (rc 5)">
  <xs:complexType name="StaffAssignmentType">
    <xs:annotation>
      <xs:appinfo>
        <sifChar />
        <privacyRating>Low</privacyRating>
      </xs:appinfo>
      <xs:documentation>Records assignment of a Staff member to a particular role at a Provider or
        other EducationOrganisation. A staff member can have multiple concurrent roles
        at Schools (via Provider data object) and Kāhui Ako (via the EducationOrganisation data object);
        each role would be a separate StaffAssignment record.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="StaffAssignmentRefId" minOccurs="0" nillable="true" type="RefIdType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The universally unique identifier for the data object record that is used across systems.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="StaffAssignmentLocalId" minOccurs="0" nillable="true" type="LocalIdType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The Id of the data object record that was provided by the system that the information 
			was originally sourced from.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="StaffAssignmentStatus" minOccurs="0" type="NZCodeSetsStaffAssignmentStatusType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>States whether or not this is an inactive or active assignment for a staff member.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="StaffMember" minOccurs="0" type="ObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the staff member, as represented in the StaffPersonal object. </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="AssignedLocation" minOccurs="0" type="ProviderObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A generic object reference to either Provider or Organisation
        that the staff member is assigned to.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EmployingOrAccommodatingProvider" minOccurs="0" nillable="true" type="NZCodeSetsYesOrNoCategoryType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Indicates whether or not this is the staff member's employing/accommodating provider. Only applies to staff members assigned to schools.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Description" minOccurs="0" nillable="true" type="xs:normalizedString">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Short description of the staff member's assignment to the provider.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="StaffRole" minOccurs="0" type="NZCodeSetsStaffRoleType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The single role the StaffMember has in relation to all students at the assigned location.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="StartDate" minOccurs="0" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>This is the date from which the staff assignment is valid (inclusive).</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EndDate" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>This is the date through which the staff assignment is valid (inclusive). This
          can be NULL when the staff member's assignment to a particular role is open-ended.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="CasualReliefTeacher" minOccurs="0" type="NZCodeSetsYesOrNoCategoryType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Is this teacher a casual relief teacher CRT?</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EmploymentStatus" minOccurs="0" nillable="true" type="NZCodeSetsStaffStatusType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>Status of staff member within this school.  Where a Staff member is employed by an organisation that
       covers more than one school, employment status may be different at each school.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="StaffSubjectList" minOccurs="0" nillable="true" type="StaffSubjectListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The set of SubjectArea/LearningAreas the that the staff member is responsible for. 
       e.g.  "Head of Dept (Maths)"  includes students learning any flavour of Mathematics.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="YearLevels" minOccurs="0" nillable="true" type="YearLevelListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The set of student Year Levels that the staff member is responsible for.
        e.g.  "Junior Student Dean" could have responsibility for all students in
         year levels 9 &amp; 10.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RecordAudit" minOccurs="0" nillable="true" type="RecordAuditType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The audit details for a record, e.g. Created/Last Updated DateTime and Created/Last Updated By.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="StaffAssignment" type="StaffAssignmentType">
    <xs:unique name="StaffAssignmentKey1">
      <xs:selector xpath="." />
      <xs:field xpath="./StaffAssignmentRefId" />
    </xs:unique>
  </xs:element>

  <xs:complexType name="StaffAssignmentCollectionType">
    <xs:sequence>
      <xs:element name="StaffAssignment" type="StaffAssignmentType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="StaffAssignments" type="StaffAssignmentCollectionType" />

</xs:schema>