<!--
		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="WellbeingEventType">
    <xs:annotation>
      <xs:appinfo>
        <sifChar />
        <privacyRating>High</privacyRating>
      </xs:appinfo>
      <xs:documentation>Record of an event happening that impacts on a school's duty of care to its students.
					The event records both 'positive' and 'negative' behaviours and is not just the recording
					of a discipline incident or an accident.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="WellbeingEventRefId" 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="WellbeingEventLocalId" 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="Student" minOccurs="0" type="StudentObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>Object reference to the student to whom this WellbeingEvent belongs.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ReportingProvider" minOccurs="0" type="ProviderObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Object reference to the provider for which this WellbeingEvent is being reported.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="PhysicalRestraint" minOccurs="0" nillable="true" type="ObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Object reference tothe StudentPhysicalRestraint if it was administered to the student as part of this WellbeingEvent.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventNotes" minOccurs="0" nillable="true" type="xs:normalizedString">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>Text relating to the particular WellbeingEvent.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="PossibleMotivationList" minOccurs="0" nillable="true" type="PossibleMotivationListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of the possible motivations that triggered the event.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventCategoryClass" minOccurs="0" nillable="true" type="NZCodeSetsWellbeingEventCategoryClassType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>Category of WellbeingEvent.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventCategoryList" minOccurs="0" nillable="true" type="WellbeingEventCategoryListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>List of Categories of WellbeingEvent.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ReportingStaffMember" minOccurs="0" nillable="true" type="ObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Object refernece to the staff member who logged the Wellbeing Event record.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventLocationList" minOccurs="0" nillable="true" type="EventLocationListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of the locations where the incident took place.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventLocationDescription" minOccurs="0" nillable="true" type="xs:normalizedString">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Medium</privacyRating>
          </xs:appinfo>
          <xs:documentation>Details of Event Location.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventCreationTimeStamp" minOccurs="0" nillable="true" type="xs:dateTime">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Date and time of the WellbeingEvent record creation.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventDate" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>The calendar date on which this WellbeingEvent occured.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventTime" minOccurs="0" nillable="true" type="xs:time">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>The time when WellbeingEvent occured.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventDescription" minOccurs="0" nillable="true" type="xs:normalizedString">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>A description of the WellbeingEvent.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventTimePeriod" minOccurs="0" nillable="true" type="NZCodeSetsWellbeingEventTimePeriodType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>Time period of when the event occurred.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ConfidentialFlag" minOccurs="0" nillable="true" type="NZCodeSetsYesOrNoCategoryType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>Flag indicating if the incident is confidential or not.  If ‘Y’ should not be shared with any other system/school.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="PersonInvolvementList" minOccurs="0" nillable="true" type="PersonInvolvementListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>List of People involved in the Wellbeing event.  Mandatory if more people than the student to which this event occurs is involved.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Status" minOccurs="0" nillable="true" type="NZCodeSetsWellbeingStatusType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>Current Status.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="BehaviourIdentifiedList" minOccurs="0" nillable="true" type="BehaviourIdentifiedListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of the problem behaviours identified for the student as a result of the Wellbeing Event. There are both minor and major behaviours.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RestraintType" minOccurs="0" nillable="true" type="NZCodeSetsWellbeingEventRestraintTypeType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>The StudentPhysicalRestraint if it was administered to the student as part of this WellbeingEvent.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ActionTakenList" minOccurs="0" nillable="true" type="ActionTakenListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of the actions taken as a result of this WellbeingEvent.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="DocumentList" minOccurs="0" nillable="true" type="DocumentListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>Describes the Location of any associated documents kept in relation to this Response.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RelatedWellbeingEventList" minOccurs="0" nillable="true" type="RelatedWellbeingEventListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>High</privacyRating>
          </xs:appinfo>
          <xs:documentation>A Wellbeing Event gets created for every student involved in an event. This list links together all related Wellbeing Events.</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="WellbeingEvent" type="WellbeingEventType">
    <xs:unique name="WellbeingEventKey1">
      <xs:selector xpath="." />
      <xs:field xpath="./WellbeingEventRefId" />
    </xs:unique>
  </xs:element>

  <xs:complexType name="WellbeingEventCollectionType">
    <xs:sequence>
      <xs:element name="WellbeingEvent" type="WellbeingEventType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="WellbeingEvents" type="WellbeingEventCollectionType" />

</xs:schema>