<!--
		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="ScheduleEventType">
    <xs:annotation>
      <xs:appinfo>
        <sifChar />
        <privacyRating>Low</privacyRating>
      </xs:appinfo>
      <xs:documentation>Defines events that may or may not impact the schedule. These
			events may simply be for display, or may affect the schools
			academic schedule.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ScheduleEventRefId" 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="ScheduleEventLocalId" 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="Provider" type="ProviderObjectReferenceType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The provider at which this event will occur</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventDate" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The start date of the event.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventEndDate" minOccurs="0" nillable="true" type="xs:date">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The end date of the event.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Duration" minOccurs="0" nillable="true" type="xs:int">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The duration of the event. If only the "EventDate" field is
			populated, the duration is in days and if omitted defaults to 1
			day; if the "EventDate" and "EventTime" fields are both
			populated, the duration is in seconds and if omitted defaults to
			3600 seconds (1 hour).</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>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The start time for the event, if required.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EventName" type="xs:normalizedString">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>The name of the event.</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>The name of location where the event will occur.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ScheduleEffect" type="NZCodeSetsScheduleEffectType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>Code denoting the effect of this ScheduleEvent on the school schedule.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ScheduleList" minOccurs="0" nillable="true" type="ScheduleListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>List of the schedules within the provider which the event
			will affect. If this event is to affect the school's academic
			schedule this field is required, otherwise it is optional.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ScheduleDayList" minOccurs="0" nillable="true" type="ScheduleDayListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of one or more academic days to be applied to the
			school calendar for the duration of this event. </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RemoveScheduleDayList" minOccurs="0" nillable="true" type="ScheduleDayListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of one or more academic days to be removed from the
			school calendar for the duration of this event. Generally only
			operates with a Schedule Effect of "add" or "custom".</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="BellScheduleList" minOccurs="0" nillable="true" type="BellScheduleListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of one or more bell schedules to be applied to the school calendar for the duration of this event.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RemoveBellScheduleList" minOccurs="0" nillable="true" type="BellScheduleListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of one or more bell schedules to be removed from the
			school calendar for the duration of this event. Generally only
			operates with a Schedule Effect of "add" or "custom".</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ScheduleTermList" minOccurs="0" nillable="true" type="ScheduleTermListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of one or more terms to be affected by this
			event. WARNING: Terms should only be specified for events that
			affect the scheduling of terms. Setting Terms on other event can
			have a disruptive effect on the school schedule.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="CustomPeriodList" minOccurs="0" nillable="true" type="ScheduleCustomDayPeriodListType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating>Low</privacyRating>
          </xs:appinfo>
          <xs:documentation>A list of generic object references to a set of
			SchedulePeriods, along with their custom start and end times,
			which are part of a 'CUSTOM' ScheduleEvent.</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="ScheduleEvent" type="ScheduleEventType">
    <xs:key name="ScheduleEventKey1">
      <xs:selector xpath="." />
      <xs:field xpath="./ScheduleEventRefId" />
    </xs:key>
  </xs:element>

  <xs:complexType name="ScheduleEventCollectionType">
    <xs:sequence>
      <xs:element name="ScheduleEvent" type="ScheduleEventType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="ScheduleEvents" type="ScheduleEventCollectionType" />

</xs:schema>