<?xml version="1.0" encoding="UTF-8"?>
<!--
    
    ** OAGIS Revision: 9.1  **
    ** Date: 11 May 2007 **
    ** Copyright 1997-2007, All Rights Reserved **
    
    This is an OAGIS BOD XML Schema (XSD) Definition.
    
    License information for this file is provided in the file **OAGi License Agreement.txt** that is provided with this download package.
    
    For support, more information, or to report implementation bugs, please contact the Open Applications Group at xml@openapplications.org.
    
    XML Schema 
    
-->

<!--
    Copyright 2007 Infor Global Solutions Technology GmbH and/or its affiliates and subsidiaries. All rights reserved. The 
    word and design marks set forth herein are trademarks and/or registered trademarks of Infor Global Solutions 
    Technology GmbH and/or its affiliates and subsidiaries. All rights reserved. All other trademarks listed herein 
    are the property of their respective owners.
    
-->

<!--    *****     Update Log     *****
    
    Date          By      Note
1 Feb 2018        LA      New noun for IoT Device, BOD-3353
    *****     Update End     *****
    
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://schema.infor.com/InforOAGIS/2"
    targetNamespace="http://schema.infor.com/InforOAGIS/2" elementFormDefault="qualified"
    attributeFormDefault="unqualified">
    
    <xsd:include schemaLocation="../Components/System/Components.xsd"/>
    
    <xsd:element name="IoTDevice" type="IoTDeviceType"/>
    
    <xsd:complexType name="IoTDeviceType">
        <xsd:complexContent>
            <xsd:extension base="StatusEnabledStandardHeaderType">
                <xsd:sequence>
                    <xsd:element ref="ThirdPartyDeviceIndicator" minOccurs="0"/>
                    <xsd:element ref="DeviceTemplateName" minOccurs="0"/>
                    <xsd:element ref="DeviceSchemaName" minOccurs="0"/>
                    <xsd:element ref="SecurityCertificate" minOccurs="0" maxOccurs="unbounded"/>
                    <xsd:element ref="DeviceAttribute" minOccurs="0" maxOccurs="unbounded"/>
                    <xsd:element ref="AssetAssociationStatus" minOccurs="0"/>
                    <xsd:element ref="Asset" minOccurs="0"/>
                    <xsd:element ref="UserArea" minOccurs="0"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>    
    </xsd:complexType>
    
    <xsd:complexType name="SecurityCertificateType">
        <xsd:sequence>
            <xsd:element ref="ID" minOccurs="0"/>
            <xsd:element ref="CreationDateTime" minOccurs="0"/>
            <xsd:element ref="ExpiryDateTime" minOccurs="0"/>
            <xsd:element ref="Status" minOccurs="0"/>
            <xsd:element ref="Policy" minOccurs="0"/> 
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="SecurityCertificate" type="SecurityCertificateType">
        <xsd:annotation>
            <xsd:documentation>
                Specifies security certificate for the device. Note that a certificate will not 
                be available for a third party device.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    
    <xsd:complexType name="SecurityPolicyType">
        <xsd:sequence>
            <xsd:element ref="Topic" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="Policy" type="SecurityPolicyType">
        <xsd:annotation>
            <xsd:documentation>
                Specifies the security policy for a device. With the current implementation
                a default security policy is applied to all the devices. This element is used 
                just as a container for the topic (since a topic is always linked to a policy)
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    
    
    <xsd:element name="Topic" type="NormalizedStringType">
        <xsd:annotation>
            <xsd:documentation>
                Specifies an MQTT topic; a topic, is a logical access point 
                and communication channel. it ks is a UTF-8 string, which is used 
                by the broker to filter messages for each connected client.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:element name="AssetAssociationStatus" type="StatusType">
        <xsd:annotation>
            <xsd:documentation>
                Indicates the status of asset integration for a device. 
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:element name="DeviceTemplateName" type="NormalizedStringType">
        <xsd:annotation>
            <xsd:documentation>
                Device template linked to the device
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:element name="DeviceSchemaName" type="NormalizedStringType">
        <xsd:annotation>
            <xsd:documentation>
                Device schema name for the device in the data catalog; the schema's elements
                represent the parameters that would be logged as reading(s) for 
                this device. The schema elements are published to the catalog with a JSON; only
                the schema name can be specified in the BOD.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:element name="DeviceAttribute" type="PropertyType">
        <xsd:annotation>
            <xsd:documentation>
                Attribute(s) of the device
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:element name="ThirdPartyDeviceIndicator" type="IndicatorType"/>
</xsd:schema>
