<!--
		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="DocumentType">
    <xs:annotation>
      <xs:appinfo>
        <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:sequence>
      <xs:element name="DocumentRefId" minOccurs="0" nillable="true" type="RefIdType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The ID (GUID) assigned to uniquely identify this Document.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="DocumentLocalId" 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="Provider" type="ProviderObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the Provider that first uploaded this document.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Location" minOccurs="0" nillable="true" type="xs:normalizedString">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Location of Documentation.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="DocumentTitle" type="xs:normalizedString">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Document's full title.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="DocumentDescription" minOccurs="0" nillable="true" type="xs:normalizedString">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>What the document is and how it is related to the Student.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="AddedDateTime" minOccurs="0" nillable="true" type="xs:dateTime">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The date the document was added at the source system.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ReviewDate" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Document Review Date.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="URL" minOccurs="0" nillable="true" type="xs:anyURI">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>URL if known.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="NoteText" minOccurs="0" nillable="true" type="xs:normalizedString">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>If the type of document is 'Note' then this is populated with the free text that makes up the note.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RelatedToList" minOccurs="0" nillable="true" type="RelatedToListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of objects that this document relates to, e.g. a Wellbeing Response or Characteristic, Physical Restraint. </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="DocumentClassification" minOccurs="0" nillable="true" type="NZCodeSetsDocumentClassificationType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The classification of the document to give an indication of the audience who should have access.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="DocumentType" type="NZCodeSetsDocumentTypeType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The type of document, e.g. Personalised Plan, Wellbeing Event or Response supporting documentation.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="PersonDocumentRoleList" minOccurs="0" nillable="true" type="PersonDocumentRoleListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The list of people associated to a document and their role in relation to it, e.g. author, owner, reviewer, subject of.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="DocumentDate" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The date of the document, e.g. the date the document was produced.</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="Document" type="DocumentType">
    <xs:key name="DocumentKey1">
      <xs:selector xpath="." />
      <xs:field xpath="./DocumentRefId" />
    </xs:key>
  </xs:element>

  <xs:complexType name="DocumentCollectionType">
    <xs:sequence>
      <xs:element name="Document" type="DocumentType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="Documents" type="DocumentCollectionType" />

</xs:schema>