<?xml version="1.0" encoding="UTF-8"?>

<!--

XML data type definition for the RESTful Network API for Communication Patterns
   version - 1.0
   date    - 12 May 2016

FILE INFORMATION

  OMA Permanent Document
    File: OMA-SUP-XSD_rest_netapi_communicationpatterns-V1_0-20160512-C
    Type: Text - Schema Description

  Public Reachable Information
    Path: http://www.openmobilealliance.org/tech/profiles
    Name: rest_netapi_communicationpatterns-V1_0.xsd

NORMATIVE INFORMATION

  Information about this file can be found in the latest revision of

    OMA-TS-REST_NETAPI_CommunicationPatterns-V1_0

  This is available at http://www.openmobilealliance.org/

  Send comments to technical-comments@mail.openmobilealliance.org

CHANGE HISTORY

05052016 Made changes to infolist captured in OMA-REST_ComPatt-2016-0023R02-CR_XML_Schema_CONR_resolutions
06052016 File name correction
12052016 Status changed to Candidate by TP, TP Ref # OMA-TP-2016-0071R01-INP_RESTNetAPI_Communication_Patterns_V1_0_ERP_for_Candidate_approval

LEGAL DISCLAIMER

  Copyright 2016 Open Mobile Alliance Ltd.  All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions
  are met:

  1. Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its
  contributors may be used to endorse or promote products derived
  from this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  POSSIBILITY OF SUCH DAMAGE.

  The above license is used as a license under copyright only.  Please
  reference the OMA IPR Policy for patent licensing terms:
  http://www.openmobilealliance.org/ipr.html
  
-->


<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   targetNamespace="urn:oma:xml:rest:netapi:communicationpatterns:1"
   xmlns:common="urn:oma:xml:rest:netapi:common:1"
   xmlns="urn:oma:xml:rest:netapi:communicationpatterns:1" version="1.0">

   <xsd:annotation>
      <xsd:documentation>This schema defines the XML data types for the RESTful Network API for Communication Pattern.</xsd:documentation>
   </xsd:annotation>

   <xsd:import namespace="urn:oma:xml:rest:netapi:common:1"
	schemaLocation="http://www.openmobilealliance.org/tech/profiles/rest_netapi_common-v1_0.xsd" />

   <!-- ======================================================== -->
   <!--     Root Element Nodes                                   -->
   <!-- ======================================================== -->

  <xsd:element name="infoList" type="InfoList"/>
  <xsd:element name="info" type="Info"/>
  <xsd:element name="configStatus" type="ConfigStatus"/>
  <xsd:element name="target" type="TargetDevices"/>
  <xsd:element name="validity" type="Validity"/>
  <xsd:element name="parameterSet" type="ParameterSet"/>

   <!-- ======================================================== -->
   <!--     Communication Pattern Data type definition           -->
   <!-- ======================================================== -->

  <xsd:complexType name="InfoList">
    <xsd:sequence> 
      <xsd:choice maxOccurs="1" minOccurs="1"> 
      		<xsd:element name="info" type="Info" maxOccurs="unbounded" minOccurs="0"/>
      		<xsd:element name="infoReference" type="common:ResourceReference" maxOccurs="unbounded" minOccurs="0"/>
      </xsd:choice>
      <xsd:element name="resourceURL" type="xsd:anyURI" maxOccurs="unbounded" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>  
   
  <xsd:complexType name="Info">
    <xsd:sequence>
      <xsd:element name="serial" type="xsd:string" maxOccurs="1" minOccurs="1"/>
      <xsd:element name="source" type="xsd:anyURI" maxOccurs="1" minOccurs="0"/>
      <xsd:element name="target" type="TargetDevices" maxOccurs="1" minOccurs="1"/>
      <xsd:element name="validity" type="Validity" maxOccurs="1" minOccurs="1"/>
      <xsd:element name="parameterSet" type="ParameterSet" maxOccurs="unbounded" minOccurs="1"/>
      <xsd:element name="resourceURL" type="xsd:anyURI" maxOccurs="1" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="TargetDevices">
    <xsd:sequence>
      <xsd:element name="address" type="xsd:anyURI" maxOccurs="unbounded" minOccurs="1"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ParameterSet">
    <xsd:sequence>
      <xsd:element name="label" type="xsd:string" maxOccurs="1" minOccurs="1"/>
      <xsd:element name="periodicCommunication" type="PeriodicCommunication" maxOccurs="1" minOccurs="1"/>
      <xsd:element name="scheduledCommunication" type="TimeRange" maxOccurs="unbounded" minOccurs="0"/>
      <xsd:element name="stationary" type="Stationary" maxOccurs="1" minOccurs="1"/>
    </xsd:sequence>
  </xsd:complexType>
   
   <xsd:complexType name="PeriodicCommunication">
    <xsd:sequence>      
      <xsd:element name="duration" type="xsd:unsignedInt" maxOccurs="1" minOccurs="0"/>
      <xsd:element name="interval" type="xsd:unsignedInt" maxOccurs="1" minOccurs="0"/>
    </xsd:sequence>
    <xsd:attribute name="indicator" type="CommIndicator" use="required" />
  </xsd:complexType>
   
  <xsd:complexType name="TimeRange">
    <xsd:sequence>
      <xsd:element name="timeOfDayStart" type="xsd:unsignedInt" maxOccurs="1" minOccurs="1"/>
      <xsd:element name="timeOfDayEnd" type="xsd:unsignedInt" maxOccurs="1" minOccurs="1"/>
      <xsd:element name="dayOfWeekMask" type="xsd:unsignedInt" maxOccurs="1" minOccurs="1"/>
      <xsd:element name="timezoneFlag" type="xsd:unsignedInt" maxOccurs="1" minOccurs="1"/>
    </xsd:sequence>
  </xsd:complexType>
   
  <xsd:complexType name="Stationary">
    <xsd:sequence>
      <xsd:element name="trajectory" type="xsd:string" maxOccurs="1" minOccurs="0"/>
    </xsd:sequence>
    <xsd:attribute name="mobilityIndicator" type="MobilityIndicator" use="required" />
  </xsd:complexType>

  <xsd:complexType name="Status">
    <xsd:sequence>
      <xsd:element name="address" type="xsd:anyURI" maxOccurs="1" minOccurs="1"/>
      <xsd:element name="code" type="StatusCode" maxOccurs="1" minOccurs="1"/>
    </xsd:sequence>
  </xsd:complexType>
   
   <xsd:complexType name="Validity">
    <xsd:sequence>
      <xsd:element name="startTime" type="xsd:dateTime" maxOccurs="1" minOccurs="0"/>
      <xsd:element name="expiryTime" type="xsd:dateTime" maxOccurs="1" minOccurs="1"/>
    </xsd:sequence>
  </xsd:complexType>
   
  <xsd:complexType name="ConfigStatus">
    <xsd:sequence>
      <xsd:element name="status" type="Status" maxOccurs="unbounded" minOccurs="1"/>
      <xsd:element name="link" type="common:Link" maxOccurs="1" minOccurs="1"/>
    </xsd:sequence>
  </xsd:complexType>

  
   <!-- ==================== -->
   <!--     Enumerations     -->
   <!-- ==================== -->

  <xsd:simpleType name="StatusCode">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="UpdateRequestQueued"/>
      <xsd:enumeration value="UpdateRequestSent"/>
      <xsd:enumeration value="Updated"/>
      <xsd:enumeration value="UpdateImpossible"/>
      <xsd:enumeration value="UpdateUnknown"/>
      <xsd:enumeration value="OutOfValidityTime"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="CommIndicator">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="OnDemand"/>
      <xsd:enumeration value="Periodic"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="MobilityIndicator">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Stationary"/>
      <xsd:enumeration value="Mobile"/>
    </xsd:restriction>
  </xsd:simpleType>

</xsd:schema>