<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : OptionFile.xsd
    Author     : raul
    Description:
        Schema que describe la estructura de los ficheros .xml de opciones
-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="option" type="optionType"/>
    
    <xsd:complexType name="optionType">
        <xsd:all> <!-- En cualquier orden pero sólo una vez -->
            <xsd:element name="components" type="componentsType"/>
        </xsd:all>
        <xsd:attribute name="name" type="xsd:string"/>
    </xsd:complexType>
    
    
    <xsd:complexType name="componentsType">
        <xsd:sequence>
            <xsd:element name="component" type="componentType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="componentType">
        <xsd:all>
            <xsd:element name="properties" type="propertiesType"/>
        </xsd:all>
        <xsd:attribute name="name" type="xsd:string"/>
        <xsd:attribute name="componentClass" type="xsd:string"/>
    </xsd:complexType>
    
    <xsd:complexType name="propertiesType">
        <xsd:sequence>
            <xsd:element name="property" type="propertyType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="propertyType">
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string"/>
            <xsd:choice>
                <xsd:element name="value" type="xsd:string"/>
                <xsd:sequence>
                    <xsd:element name="param" minOccurs="0" maxOccurs="unbounded">
                        <xsd:complexType>
                            <xsd:simpleContent>
                                <xsd:extension base="xsd:string">
                                    <xsd:attribute name="paramClass" type="xsd:string"/>
                                    <xsd:attribute name="paramName" type="xsd:string"/>
                                </xsd:extension>
                            </xsd:simpleContent>
                        </xsd:complexType>
                    </xsd:element>
                </xsd:sequence>
            </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="propertyClass" type="xsd:string"/>
        <xsd:attribute name="type" type="xsd:string"/>
    </xsd:complexType>
    
</xsd:schema>
