<!--
		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="StudentAttainmentType">
    <xs:annotation>
      <xs:appinfo>
        <sifChar />
        <privacyRating>Low</privacyRating>
      </xs:appinfo>
      <xs:documentation>Records a student gaining an Attainment e.g. NCEA Qualification, Learning Standard etc.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="StudentAttainmentRefId" minOccurs="0" nillable="true" type="RefIdType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</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:element>
      <xs:element name="StudentAttainmentLocalId" 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="GrantingProvider" minOccurs="0" type="ProviderObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the Provider/Organisation who is granting the attainment to the student, e.g. NZQA, TEC.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Attainment" minOccurs="0" type="ObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A generic object reference to the type of attainment the student has achieved
          e.g. ProviderCourse, LeanringStandard etc.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Student" minOccurs="0" type="StudentObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the student held in the StudentPersonal data
        object who the attainment is for.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="AuthorisingStaffMember" minOccurs="0" nillable="true" type="ObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Generic object reference to the StaffPersonal data object representing the
          staff member who authorised the attainment.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="DateAttained" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The date the student achieved the attainment.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="YearAttained" minOccurs="0" nillable="true" type="xs:gYear">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The year the student achieved the attainment.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="JustificationList" minOccurs="0" nillable="true" type="JustificationListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of references identifying the assessment task results that
          justify the student achieving this attainment.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="SubjectAreaList" minOccurs="0" nillable="true" type="SubjectAreaListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Code denoting the Learning or Subject Area the assessment task is for.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EndorsementLevel" minOccurs="0" nillable="true" type="NZCodeSetsNCEAEndorsementLevelType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The NCEA endorsement level that was attained by the student.</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="StudentAttainment" type="StudentAttainmentType">
    <xs:unique name="StudentAttainmentKey1">
      <xs:selector xpath="." />
      <xs:field xpath="./StudentAttainmentRefId" />
    </xs:unique>
  </xs:element>

  <xs:complexType name="StudentAttainmentCollectionType">
    <xs:sequence>
      <xs:element name="StudentAttainment" type="StudentAttainmentType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="StudentAttainments" type="StudentAttainmentCollectionType" />

</xs:schema>