<!--
		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:sequence>
      <xs:element name="ProviderRelationshipRefId" minOccurs="0" nillable="true" type="RefIdType" />
      <xs:element name="ProviderRelationshipLocalId" minOccurs="0" nillable="true" type="LocalIdType" />
      <xs:element name="Status" type="NZCodeSetsOrganisationRelationshipStatusType" />
      <xs:element name="RelationshipType" type="NZCodeSetsOrganisationRelationshipTypeType" />
      <xs:element name="SourceOrganisation" type="OrganisationObjectReferenceType" />
      <xs:element name="SourceOrganisationRole" minOccurs="0" nillable="true" type="NZCodeSetsSourceOrganisationRoleType" />
      <xs:element name="SourceOrganisationAgreementDate" minOccurs="0" nillable="true" type="xs:date" />
      <xs:element name="RelatedOrganisation" type="OrganisationObjectReferenceType" />
      <xs:element name="RelatedOrganisationRole" minOccurs="0" nillable="true" type="NZCodeSetsRelatedOrganisationRoleType" />
      <xs:element name="RelatedOrganisationAgreementDate" minOccurs="0" nillable="true" type="xs:date" />
      <xs:element name="EffectiveDate" type="xs:date" />
      <xs:element name="ExpirationDate" minOccurs="0" nillable="true" type="xs:date" />
      <xs:element name="YearLevelList" minOccurs="0" nillable="true" type="YearLevelListType" />
      <xs:element name="SubjectAreaList" minOccurs="0" nillable="true" type="SubjectAreaListType" />
      <xs:element name="Description" minOccurs="0" nillable="true" type="xs:normalizedString" />
      <xs:element name="RecordAudit" minOccurs="0" nillable="true" type="RecordAuditType" />
    </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>