<!--
		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="StudentConsentType">
    <xs:annotation>
      <xs:appinfo>
        <sifChar />
        <privacyRating>Extreme</privacyRating>
      </xs:appinfo>
      <xs:documentation>A record of Student's consent or non-consent to some action taking place.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="StudentConsentRefId" minOccurs="0" nillable="true" type="RefIdType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Medium</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="StudentConsentLocalId" minOccurs="0" nillable="true" type="LocalIdType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Medium</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="Student" minOccurs="0" type="StudentObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Medium</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the student granting or revoking this student consent.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Organisation" minOccurs="0" type="ProviderObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Medium</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the organisation being granted this student consent.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="StaffMember" minOccurs="0" nillable="true" type="ObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Medium</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the staff member that is recording this consent.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ConsentTo" minOccurs="0" type="NZCodeSetsStudentConsentToType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>What the student is consenting or not consenting to.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ConsentGiven" minOccurs="0" type="NZCodeSetsYesNoNotRequiredType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>Indicates whether or not censent was given, or specifically not given</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ConsentGivenBy" minOccurs="0" nillable="true" type="NZCodeSetsConsentGivenByType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>The role of the person who gave consent on behalf of the student, e.g. Whānau, Learner.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ConsentDate" minOccurs="0" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>The date the consent or no consent was given.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ConsentRevokedDate" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>The date the consent ended, if it was given.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RelatedObject" minOccurs="0" nillable="true" type="ObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Medium</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to a data object that relates to this consent.  e.g. the student enrolment record this consent was captured as part of.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="AdditionalInformation" minOccurs="0" nillable="true" type="xs:normalizedString">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation> Additional free text information provided about the consent.</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="StudentConsent" type="StudentConsentType">
    <xs:unique name="StudentConsentKey1">
      <xs:selector xpath="." />
      <xs:field xpath="./StudentConsentRefId" />
    </xs:unique>
  </xs:element>

  <xs:complexType name="StudentConsentCollectionType">
    <xs:sequence>
      <xs:element name="StudentConsent" type="StudentConsentType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="StudentConsents" type="StudentConsentCollectionType" />

</xs:schema>