<!--
		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="ProviderType">
    <xs:annotation>
      <xs:appinfo>
        <sifChar />
        <privacyRating>Low</privacyRating>
      </xs:appinfo>
      <xs:documentation>A recognised provider of education services in the New Zealand
			education system.  Providers may operate in the Early Childhood, Compulsory Schooling or Tertiary sectors.
    	</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="EduOrganisationType">
        <xs:sequence>
          <xs:element name="ProviderRefId" type="MoEOrgIdType">
            <xs:annotation>
              <xs:appinfo>
                <sifChar>M</sifChar>
                <privacyRating>Low</privacyRating>
              </xs:appinfo>
              <xs:documentation>1 to 5 digit Ministry Organisation Id for the Provider, without leading zeros</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="Authority" minOccurs="0" nillable="true" type="NZCodeSetsProviderAuthorityType">
            <xs:annotation>
              <xs:appinfo>
                <sifChar>O</sifChar>
                <privacyRating>Low</privacyRating>
              </xs:appinfo>
              <xs:documentation>A code denoting the authority by which the Provider is authorised to
		  provide education services.
		  </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="SchoolService" minOccurs="0" nillable="true" type="SchoolServiceType">
            <xs:annotation>
              <xs:appinfo>
                <sifChar>O</sifChar>
                <privacyRating>Low</privacyRating>
              </xs:appinfo>
              <xs:documentation>Only present if the Provider is a provider of school education services.
		  Contains properties that are school-specific. </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="ECEService" minOccurs="0" nillable="true" type="ECEServiceType">
            <xs:annotation>
              <xs:appinfo>
                <sifChar>O</sifChar>
                <privacyRating>Low</privacyRating>
              </xs:appinfo>
              <xs:documentation>Only present if the Provider is a provider of early childhood education services.
		  Contains properties that are ECE specific.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="TertiaryService" minOccurs="0" nillable="true" type="TertiaryServiceType">
            <xs:annotation>
              <xs:appinfo>
                <sifChar>O</sifChar>
                <privacyRating>Low</privacyRating>
              </xs:appinfo>
              <xs:documentation>Only present if the Provider is a provider of tertiary education services.
		  Contains properties that are Tertiary Education specific.</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:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="Provider" type="ProviderType">
    <xs:key name="ProviderKey1">
      <xs:selector xpath="." />
      <xs:field xpath="./ProviderRefId" />
    </xs:key>
  </xs:element>

  <xs:complexType name="ProviderCollectionType">
    <xs:sequence>
      <xs:element name="Provider" type="ProviderType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="Providers" type="ProviderCollectionType" />

</xs:schema>