<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="CommandLine"
    elementFormDefault="qualified" 
    attributeFormDefault="unqualified"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:CommandLine="CommandLine">
 
    <complexType name="CommandsType">
        <choice minOccurs="0" maxOccurs="unbounded">
            <element name="Command" type="CommandLine:CommandType" />
        </choice>
    </complexType>

    <element name="Commands" type="CommandLine:CommandsType"/>

    <complexType name="CommandType" >
        <sequence minOccurs="1" maxOccurs="unbounded">
            <element name="Syntax" type="CommandLine:SyntaxType" />
        </sequence>
        <attribute name="Keyword" type="string" use="required"/>
        <attribute name="Description" type="string" use="required"/>
        <attribute name="Advanced" type="boolean" default="false"/>
    </complexType>

    <complexType name="SyntaxType" >
        <sequence minOccurs="0" maxOccurs="unbounded">
            <element ref="CommandLine:Arg"/>
        </sequence>
        <attribute name="Help" type="string" use="required"/>
    </complexType>

    <simpleType name="RequiredType">
        <restriction base="token">
            <enumeration value="NOT_REQUIRED"/>
            <enumeration value="REQUIRED"/>
            <enumeration value="REQUIRED_AFTER_PREVIOUS"/>
        </restriction>
    </simpleType>

    <complexType name="ArgType" >
        <attribute name="Required" type="CommandLine:RequiredType" default="REQUIRED"/>
    </complexType>
    
    <element name="Arg" type="CommandLine:ArgType" abstract="true"/>
    
    <element name="ARG_COMMAND" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_COMPONENT" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_CONFIG_DIR" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_FLOAT" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_INT" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_MISSION" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_QUOTED_STRING" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_REGEX" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_SECONDS" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_STRING" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_TOKEN" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_UNIT" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_UNIVERSAL" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    <element name="ARG_VARIABLE" type="CommandLine:ArgType" substitutionGroup="CommandLine:Arg"/>
    
    <complexType name="KeywordArgType" >
        <complexContent>
            <extension base="CommandLine:ArgType">
                <attribute name="Keyword" type="string" use="required"/>
            </extension>
        </complexContent>
    </complexType>
    
    <element name="ARG_KEYWORD" type="CommandLine:KeywordArgType" substitutionGroup="CommandLine:Arg"/>

</schema>