<!--
		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="StudentContactRelationshipType">
    <xs:annotation>
      <xs:appinfo>
        <sifChar />
        <privacyRating>High</privacyRating>
      </xs:appinfo>
      <xs:documentation>A relationship between a person who is part of a Student's whānau and that Student.
				Relationship properties include the relationship type and roles played by the student contact
				in respect of the student.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="StudentContactRelationshipRefId" 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="StudentContactRelationshipLocalId" 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="Status" type="NZCodeSetsStudentContactRelationshipStatusType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>States whether or not this is an inactive or active Student Contact Relationship.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="StartDate" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The date the relationship between the student and contact was recorded.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EndDate" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The date the relationship between the student and contact was removed.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Student" type="StudentObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Medium</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the Student.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="StudentContact" type="ObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Medium</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the student contact.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Provider" type="ObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the Provider associated with the relationship.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Relationship" type="RelationshipType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Medium</privacyRating>
          </xs:appinfo>
          <xs:documentation>Defines the relationship of the contact to the student.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="LanguageUsed" minOccurs="0" nillable="true" type="NZCodeSetsLanguageType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The language the student and their contact use to communicate.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="HouseholdList" minOccurs="0" nillable="true" type="HouseholdListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Medium</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of one or more household identifiers indicating the
			households associated with this relationship.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ContactFlags" minOccurs="0" nillable="true" type="ContactFlagsType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>C</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>Contains characteristics of the contact person's role with the Student. 
			At least one of the flags must be populated with a 'Yes' value.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ContactSequence" minOccurs="0" nillable="true" type="xs:unsignedInt">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Number indicating the order in which the student contact should be contacted.</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="StudentContactRelationship" type="StudentContactRelationshipType">
    <xs:key name="StudentContactRelationshipKey1">
      <xs:selector xpath="." />
      <xs:field xpath="./StudentContactRelationshipRefId" />
    </xs:key>
  </xs:element>

  <xs:complexType name="StudentContactRelationshipCollectionType">
    <xs:sequence>
      <xs:element name="StudentContactRelationship" type="StudentContactRelationshipType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="StudentContactRelationships" type="StudentContactRelationshipCollectionType" />

</xs:schema>