<!--
		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="ProviderRelationshipType">
    <xs:annotation>
      <xs:appinfo>
        <sifChar />
        <privacyRating>Low</privacyRating>
      </xs:appinfo>
      <xs:documentation>Records a recognised relationship between two education Providers. The two providers
         are referred	 to as the Source Provider and the Related Provider.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ProviderRelationshipRefId" 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="ProviderRelationshipLocalId" 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="Status" type="NZCodeSetsOrganisationRelationshipStatusType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Records if this OrganisationRelationship is Active or Inactive</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RelationshipType" type="NZCodeSetsOrganisationRelationshipTypeType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The SIF GUID for the source provider in the relationship.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="SourceOrganisation" type="OrganisationObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the source provider in the relationship.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="SourceOrganisationRole" minOccurs="0" nillable="true" type="NZCodeSetsSourceOrganisationRoleType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The role the source organisation is playing in this relationship.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="SourceOrganisationAgreementDate" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The date the source Provider in the relationship registered their agreement to the relationship.
      nil value if the source Provider is yet to register their agreement ot the relationship.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RelatedOrganisation" type="OrganisationObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the related provider in the relationship.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RelatedOrganisationRole" minOccurs="0" nillable="true" type="NZCodeSetsRelatedOrganisationRoleType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The role the related organisation is playing in this relationship.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RelatedOrganisationAgreementDate" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The date the related Provider in the relationship registered their agreement to the relationship.
      nil value if the related Provider is yet to register their agreement ot the relationship.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EffectiveDate" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The date from which the provider relationship is active.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ExpirationDate" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The date after which the provider relationship is no longer active.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="YearLevelList" minOccurs="0" nillable="true" type="YearLevelListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of YearLevels, denoting the year levels of the
		  learners being hosted or sent from the client or contributing provider</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="SubjectAreaList" minOccurs="0" nillable="true" type="SubjectAreaListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of Subject or Learning Areas, denoting the curriculum subjects or learning areas that 
      the learners being sent by the Source Provider are taught at the Related Provider.</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>Free text description providing more detail about the provider relationship.</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="ProviderRelationship" type="ProviderRelationshipType">
    <xs:key name="ProviderRelationshipKey1">
      <xs:selector xpath="." />
      <xs:field xpath="./ProviderRelationshipRefId" />
    </xs:key>
  </xs:element>

  <xs:complexType name="ProviderRelationshipCollectionType">
    <xs:sequence>
      <xs:element name="ProviderRelationship" type="ProviderRelationshipType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="ProviderRelationships" type="ProviderRelationshipCollectionType" />

</xs:schema>