<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

    <xsd:element name="plugin" type="PluginTyp" />

    <xsd:complexType name="PluginTyp">
        <xsd:sequence>
            <xsd:element name="general" type="GeneralTyp" minOccurs="1" maxOccurs="1" />
            <xsd:element name="requirements" type="RequirementsTyp" minOccurs="1" maxOccurs="1" />
            <xsd:element name="dependencies" type="PluginDependenciesTyp" minOccurs="0" maxOccurs="1" />
            <xsd:choice maxOccurs="1" minOccurs="1">
            <xsd:element name="contenido" type="ContenidoTyp" minOccurs="1" maxOccurs="1" />
            <xsd:element name="conlite" type="ContenidoTyp" minOccurs="1" maxOccurs="1" />
            </xsd:choice>
            <xsd:element name="content_types" type="ContentTypes" minOccurs="0" maxOccurs="1" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="GeneralTyp">
        <xsd:all>
            <xsd:element name="plugin_name" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="plugin_foldername" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="uuid" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="author" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="copyright" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="mail" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="website" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="version" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="license" type="xsd:string" minOccurs="0" maxOccurs="1" />
        </xsd:all>
        <xsd:attribute name="active" default="1" />
    </xsd:complexType>

    <xsd:complexType name="RequirementsTyp">
        <xsd:sequence minOccurs="0">
            <xsd:choice maxOccurs="1" minOccurs="1">
                <xsd:element name="contenido" type="RequirementsContenidoTyp" />
                <xsd:element name="conlite" type="RequirementsConLiteTyp" />
            </xsd:choice>            
            <xsd:element name="extension" type="RequirementsExtensionTyp" minOccurs="0" />
            <xsd:element name="class" type="RequirementsClassTyp" minOccurs="0" />
            <xsd:element name="function" type="RequirementsFunctionTyp" minOccurs="0" />
        </xsd:sequence>
        <xsd:attribute name="php" type="xsd:string" default="5.3" />
    </xsd:complexType>

    <xsd:complexType name="RequirementsContenidoTyp">
        <xsd:attribute name="minversion" type="xsd:string" use="required" />
        <xsd:attribute name="maxversion" type="xsd:string" />
    </xsd:complexType>
    <xsd:complexType name="RequirementsConLiteTyp">
        <xsd:attribute name="minversion" type="xsd:string" use="required" />
        <xsd:attribute name="maxversion" type="xsd:string" />
    </xsd:complexType>

    <xsd:complexType name="RequirementsExtensionTyp">
        <xsd:attribute name="name" type="xsd:string" />
    </xsd:complexType>

    <xsd:complexType name="RequirementsClassTyp">
        <xsd:attribute name="name" type="xsd:string" />
    </xsd:complexType>

    <xsd:complexType name="RequirementsFunctionTyp">
        <xsd:attribute name="name" type="xsd:string" />
    </xsd:complexType>

    <xsd:complexType name="PluginDependenciesTyp">
        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="depend">
                <xsd:complexType>
                    <xsd:simpleContent>
                        <xsd:extension base="xsd:string">
                            <xsd:attribute name="uuid" type="xsd:string" use="required" />
                            <xsd:attribute name="minversion" type="xsd:string" />
                            <xsd:attribute name="maxversion" type="xsd:string" />
                        </xsd:extension>
                    </xsd:simpleContent>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ContenidoTyp">
        <xsd:sequence minOccurs="0">
            <xsd:element name="areas" type="ContenidoAreasTyp" />
            <xsd:element name="actions" type="ContenidoActionsTyp" minOccurs="0" />
            <xsd:element name="frames" type="ContenidoFramesTyp" minOccurs="0" />
            <xsd:element name="nav_main" type="ContenidoNavMainTyp" minOccurs="0" />
            <xsd:element name="nav_sub" type="ContenidoNavSubTyp" minOccurs="0" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ContenidoAreasTyp">
        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="area">
                <xsd:complexType>
                    <xsd:simpleContent>
                        <xsd:extension base="xsd:string">
                            <xsd:attribute name="parent" type="xsd:string" />
                            <xsd:attribute name="menuless" type="xsd:integer" default="0" />
                            <xsd:attribute name="relevant" type="xsd:integer" default="1" />
                        </xsd:extension>
                    </xsd:simpleContent>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ContenidoActionsTyp">
        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="action">
                <xsd:complexType>
                    <xsd:simpleContent>
                        <xsd:extension base="xsd:string">
                            <xsd:attribute name="area" type="xsd:string" use="required" />
                            <xsd:attribute name="relevant" type="xsd:integer" default="1" />
                        </xsd:extension>
                    </xsd:simpleContent>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ContenidoFramesTyp">
        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="frame">
                <xsd:complexType>
                    <xsd:simpleContent>
                        <xsd:extension base="xsd:string">
                            <xsd:attribute name="area" type="xsd:string" use="required" />
                            <xsd:attribute name="filetype" type="xsd:string" default="main" />
                            <xsd:attribute name="name" type="xsd:string" use="required" />
                            <xsd:attribute name="frameId" type="xsd:integer" use="required" />
                        </xsd:extension>
                    </xsd:simpleContent>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ContenidoNavMainTyp">
        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="nav">
                <xsd:complexType>
                    <xsd:simpleContent>
                        <xsd:extension base="xsd:string">
                            <xsd:attribute name="name" type="xsd:string" />
                        </xsd:extension>
                    </xsd:simpleContent>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ContenidoNavSubTyp">
        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="nav">
                <xsd:complexType>
                    <xsd:simpleContent>
                        <xsd:extension base="xsd:string">
                            <xsd:attribute name="area" type="xsd:string" use="required" />
                            <xsd:attribute name="level" type="xsd:integer" use="required" />
                            <xsd:attribute name="navm" />
                        </xsd:extension>
                    </xsd:simpleContent>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ContentTypes">
        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="type" type="xsd:string" />
        </xsd:sequence>
    </xsd:complexType>

</xsd:schema>