<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
			xmlns:rois="http://www.omg.org/spec/RoIS/20240801"
			xmlns:gml="http://www.opengis.net/gml/3.2"
			targetNamespace="http://www.omg.org/spec/RoIS/20240801"
			elementFormDefault="qualified" attributeFormDefault="qualified">

  <xsd:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>

  <!-- Profile -->
  <xsd:complexType name="RoISIdentifierType">
	<xsd:attribute name="authority" type="xsd:string" use="optional"/>
	<xsd:attribute name="code" type="xsd:string" use="required"/>
	<xsd:attribute name="codebook_ref" type="xsd:string" use="optional"/>
	<xsd:attribute name="version" type="xsd:string" use="optional"/>
  </xsd:complexType>

  <xsd:element name="HRIEngineProfile" type="rois:HRIEngineProfileType"/>
  <xsd:complexType name="HRIEngineProfileType">
	<xsd:complexContent>
	  <xsd:extension base="gml:IdentifiedObjectType">
		<xsd:sequence>
		  <xsd:element name="SubProfile" type="rois:HRIEngineProfileType" minOccurs="0" maxOccurs="unbounded"/>
		  <xsd:element name="HRIComponent" type="xsd:ID" minOccurs="1" maxOccurs="unbounded"/>
		  <xsd:element ref="rois:ParameterProfile" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	  </xsd:extension>
	</xsd:complexContent>
  </xsd:complexType>

  <xsd:element name="HRIComponentProfile" type="rois:HRIComponentProfileType"/>
  <xsd:complexType name="HRIComponentProfileType">
	<xsd:complexContent>
	  <xsd:extension base="gml:IdentifiedObjectType">
		<xsd:sequence>
		  <xsd:element name="SubComponentProfile" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
		  <xsd:element name="MessageProfile" type="rois:MessageProfileType" minOccurs="0" maxOccurs="unbounded"/>
		  <xsd:element ref="rois:ParameterProfile" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	  </xsd:extension>
	</xsd:complexContent>
  </xsd:complexType>

  <xsd:element name="ParameterProfile" type="rois:ParameterProfileType"/>
  <xsd:complexType name="ParameterProfileType">
	<xsd:sequence>
	  <xsd:element name="data_type_ref" type="rois:RoISIdentifierType" minOccurs="1" maxOccurs="1"/>
	</xsd:sequence>
	<xsd:attribute name="name" type="xsd:string" use="required"/>
	<xsd:attribute name="default_value" type="xsd:string" use="optional"/>
	<xsd:attribute name="description" type="xsd:string" use="optional"/>
  </xsd:complexType>
  
  <xsd:element name="MessageProfile" type="rois:MessageProfileType"/>
  <xsd:complexType name="MessageProfileType">
	<xsd:sequence>
	  <xsd:element name="Results" type="rois:ParameterProfileType" minOccurs="0" maxOccurs="unbounded"/>
	</xsd:sequence>
	<xsd:attribute name="name" type="xsd:string" use="required"/>
  </xsd:complexType>

  <xsd:element name="EventMessageProfile" type="rois:EventMessageProfileType" substitutionGroup="rois:MessageProfile"/>
  <xsd:complexType name="EventMessageProfileType">
	<xsd:complexContent>
	  <xsd:extension base="rois:MessageProfileType"/>
	</xsd:complexContent>
  </xsd:complexType>

  <xsd:element name="QueryMessageProfile" type="rois:QueryMessageProfileType" substitutionGroup="rois:MessageProfile"/>
  <xsd:complexType name="QueryMessageProfileType">
	<xsd:complexContent>
	  <xsd:extension base="rois:MessageProfileType"/>
	</xsd:complexContent>
  </xsd:complexType>

  <xsd:element name="CommandMessageProfile" type="rois:CommandMessageProfileType" substitutionGroup="rois:MessageProfile"/>
  <xsd:complexType name="CommandMessageProfileType">
	<xsd:complexContent>
	  <xsd:extension base="rois:MessageProfileType">
		<xsd:sequence>
		  <xsd:element name="Arguments" type="rois:ParameterProfileType" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="timeout" type="xsd:integer" use="optional"/>
	  </xsd:extension>
	</xsd:complexContent>
  </xsd:complexType>

  <!-- Data Structure -->
  <xsd:element name="Parameter" type="rois:ParameterType"/>
  <xsd:complexType name="ParameterType">
	<xsd:sequence>
	  <xsd:element name="data_type_ref" type="rois:RoISIdentifierType" minOccurs="1" maxOccurs="1"/>
	  <xsd:element name="value" type="xsd:string" minOccurs="1" maxOccurs="1"/>
	</xsd:sequence>
	<xsd:attribute name="name" type="xsd:string" use="required"/>
  </xsd:complexType>

  <xsd:element name="ArgumentList" type="rois:ArgumentListType"/>
  <xsd:complexType name="ArgumentListType">
	<xsd:sequence>
	  <xsd:element name="parameter" type="rois:ParameterType" minOccurs="1" maxOccurs="unbounded"/>
	</xsd:sequence>
  </xsd:complexType>

  <xsd:element name="CommandUnitSequence" type="rois:CommandUnitSequenceType"/>
  <xsd:complexType name="CommandUnitSequenceType">
	<xsd:sequence>
	  <xsd:element name="command_unit_list" type="rois:CommandBaseType" minOccurs="1" maxOccurs="unbounded"/>
	</xsd:sequence>
  </xsd:complexType>

  <xsd:element name="CommandBase" type="rois:CommandBaseType" abstract="true"/>
  <xsd:complexType name="CommandBaseType">
	<xsd:attribute name="delay_time" type="xsd:integer" use="optional"/>
  </xsd:complexType>

  <xsd:element name="CommandMessage" type="rois:CommandMessageType" substitutionGroup="rois:CommandBase" />
  <xsd:complexType name="CommandMessageType">
	<xsd:complexContent>
	  <xsd:extension base="rois:CommandBaseType">
		<xsd:sequence>
		  <xsd:element name="component_ref" type="rois:RoISIdentifierType" minOccurs="1" maxOccurs="1"/>
		  <xsd:element name="arguments" type="rois:ArgumentListType" minOccurs="0" maxOccurs="1"/>
		</xsd:sequence>
		<xsd:attribute name="command_id" type="xsd:string" use="required"/>
		<xsd:attribute name="command_type" type="xsd:string" use="required"/>
	  </xsd:extension>
	</xsd:complexContent>
  </xsd:complexType>

  <xsd:element name="ConcurrentCommands" type="rois:ConcurrentCommandsType" substitutionGroup="rois:CommandBase" />
  <xsd:complexType name="ConcurrentCommandsType">
	<xsd:complexContent>
	  <xsd:extension base="rois:CommandBaseType">
	  	<xsd:sequence>
		  <xsd:element name="command_list" type="rois:CommandMessageType" maxOccurs="unbounded" />	
	  	</xsd:sequence>
	  </xsd:extension>
	</xsd:complexContent>
  </xsd:complexType>

  <xsd:element name="Branch" type="rois:BranchType" />
  <xsd:complexType name="BranchType">
	<xsd:sequence>
	  <xsd:element name="command_list" type="rois:CommandMessageType" maxOccurs="unbounded" />
	</xsd:sequence>
  </xsd:complexType>

</xsd:schema>
