<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:envelope_1_0="http://agavi.org/agavi/config/global/envelope/1.0"
    xmlns:types_1_0="http://agavi.org/agavi/config/global/types/1.0"
    xmlns="http://icinga.org/api/config/parts/icingacommands/1.0"
    targetNamespace="http://icinga.org/api/config/parts/icingacommands/1.0"
    elementFormDefault="qualified"
>

    <xs:import namespace="http://agavi.org/agavi/config/global/types/1.0"
               schemaLocation="../../../../../../../lib/agavi/src/config/xsd/_types.xsd" />
    <xs:import namespace="http://agavi.org/agavi/config/global/envelope/1.0"
               schemaLocation="../../../../../../../lib/agavi/src/config/xsd/_envelope.xsd" />
    <xs:attributeGroup name="parameterAttrs">
        <xs:attribute name="type" use="optional" type="xs:string" />
        <xs:attribute name="name" use="optional" type="xs:string" />
        <xs:attribute name="alias" use="optional" type="xs:string" />
        <xs:attribute name="ref" use="optional" type="xs:string" />
        <xs:attribute name="required" use="optional" type="xs:boolean" />  
        <xs:attribute name="defaultChecked" use="optional" type="xs:string" />
        <xs:attribute name="defaultValue" use="optional" type="xs:string" />
    </xs:attributeGroup> 
    
    <xs:complexType name="parameter">
       <xs:attributeGroup ref="parameterAttrs" />
    </xs:complexType> 
    
    <xs:simpleType name="commandType">
        <xs:restriction base="xs:normalizedString">
            <xs:enumeration value="host"/>
            <xs:enumeration value="service"/>
            <xs:enumeration value="hostgroup"/>
            <xs:enumeration value="servicegroup"/>
            <xs:enumeration value="process"/>
            <xs:enumeration value="downtime"/>
            <xs:enumeration value="notification"/>
            <xs:enumeration value="unknown"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:complexType name="command" mixed="true">       
        <xs:sequence>
            <xs:element name="definition" type="xs:string" minOccurs="1" maxOccurs="1"/>
            <xs:element name="isSimple" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
            <xs:element name="type" type="commandType" minOccurs="1" maxOccurs="1"/>
            <xs:element name="iconCls" type="xs:string" minOccurs="1" maxOccurs="1"/>
            <xs:element name="label" type="xs:string" minOccurs="1" maxOccurs="1"/>
            <xs:element name="parameters" type="parameters" minOccurs="1"></xs:element>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" /> 
    </xs:complexType>

    <xs:complexType name="commands" mixed="true">
        <xs:sequence>
            <xs:element name="command" type="command" maxOccurs="unbounded"></xs:element>
        </xs:sequence>
    </xs:complexType>
    
    <xs:complexType name="parameters" mixed="true">
        <xs:sequence>
            <xs:element name="parameter" type="parameter" minOccurs="0" maxOccurs="unbounded"></xs:element>
        </xs:sequence>
    </xs:complexType>
    

    <xs:group name="configuration">
        <xs:all>
            <xs:element name="commands" type="commands" minOccurs="0"></xs:element> 
            <xs:element name="parameters" type="parameters" minOccurs="1" maxOccurs="1"></xs:element>   
        </xs:all>
    </xs:group>
    
    
</xs:schema>
