<?xml version="1.0" encoding="UTF-8"?>
<!-- should not be suffixed with xsd otherwise xsdcxx is going to duplicate all types ! -->
<!-- merge using  and manual edit -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://camitk.imag.fr/cepcoreschema"
            targetNamespace="http://camitk.imag.fr/cepcoreschema"
            elementFormDefault="qualified"
>

    <xsd:simpleType name="ParameterType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="int" />
            <xsd:enumeration value="bool"/>
            <xsd:enumeration value="double" />
            <xsd:enumeration value="QString"/>
            <xsd:enumeration value="QDate"/>
            <xsd:enumeration value="QTime"/>
            <xsd:enumeration value="QColor" />
            <xsd:enumeration value="QPoint" />
            <xsd:enumeration value="QPointF"/>
            <xsd:enumeration value="QVector3D"/>
            <xsd:enumeration value="QVector4D"/>
        </xsd:restriction>
    </xsd:simpleType>

<!-- Contact.xsd -->

<!-- Email.xsd -->
<xsd:simpleType name="Email">
    <xsd:restriction base="xsd:string">
        <xsd:pattern value="[^@]+@[^\.]+\..+"/>
    </xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="Contact">
    <xsd:sequence>
        <xsd:element name="email" type="Email" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>
<!-- ActionExtensions.xsd -->
<!-- ActionExtension.xsd -->
<!-- Actions.xsd -->
<!-- Action.xsd -->
<!-- ClassName.xsd -->
<xsd:simpleType name="ClassName">
    <!-- A Class name should begin with an upper case letter and be followed
    by lower or upper case letters.
    -->
    <xsd:restriction base="xsd:string">
        <xsd:pattern value="[A-Z](([a-z])*|([A-Z])*)+"/>
    </xsd:restriction>
</xsd:simpleType>
<!-- Classification.xsd -->

<!-- ItkFilter.xsd -->
<!-- ITKOutputType.xsd -->
<xsd:simpleType name="ITKOutputType">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="Same as Input"/>
        <xsd:enumeration value="unsigned char"/>
        <xsd:enumeration value="char"/>
        <xsd:enumeration value="unsigned short"/>
        <xsd:enumeration value="short"/>
        <xsd:enumeration value="unsigned int"/>
        <xsd:enumeration value="int" />
        <xsd:enumeration value="long"/>
        <xsd:enumeration value="double"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="ItkFilter">
    <xsd:attribute name="outputType" type="ITKOutputType" use="required"/>
</xsd:complexType>
<xsd:complexType name="Classification">
    <xsd:sequence>
        <xsd:element name="family" type="xsd:string"/>
        <xsd:element name="tag" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
        <xsd:element name="itkFilter" type="ItkFilter" minOccurs = "0" maxOccurs = "1"/>
    </xsd:sequence>
</xsd:complexType>
<!-- Parameters.xsd -->
<!-- Parameter.xsd -->

<xsd:complexType name="Parameter">
    <xsd:attribute name="name" use="required" type="xsd:string"/>
    <xsd:attribute name="type" use="required" type="ParameterType"/>
    <xsd:attribute name="description" use="required" type="xsd:string"/>
    <xsd:attribute name="unit" type="xsd:string"/>
    <xsd:attribute name="defaultValue" type="xsd:string"/>
    <xsd:attribute name="editable" type="xsd:boolean" default="true"/>
</xsd:complexType>

<xsd:complexType name="Parameters">
    <xsd:sequence>
        <xsd:element name="parameter" type="Parameter" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>
<!-- ActionProperties.xsd -->
<xsd:complexType name="ActionProperties">
    <xsd:attribute name="modal" type="xsd:boolean"/>
    <xsd:attribute name="embedded" type="xsd:boolean"/>
    <xsd:attribute name="delayed" type="xsd:boolean"/>
</xsd:complexType>


<xsd:complexType name="Action">
    <xsd:sequence>
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="description" type="xsd:string"/>
        <xsd:element name="component" type="ClassName"/>
        <xsd:element name="classification" type="Classification"/>
        <xsd:element name="parameters" type="Parameters" minOccurs="0"/>
        <xsd:element name="properties" type="ActionProperties" minOccurs="0"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="Actions">
    <xsd:sequence>
        <xsd:element name="action" type="Action" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>
<!-- DirectoryName.xsd -->
<xsd:simpleType name="DirectoryName">
    <!-- A Directory must be in lower case and have at list one letter -->
    <xsd:restriction base="xsd:string">
        <xsd:pattern value="([a-z])+"/>
    </xsd:restriction>
</xsd:simpleType>
<!-- Dependencies.xsd -->
<!-- Dependency.xsd -->
<!-- DependencyType.xsd -->
<xsd:simpleType name="DependencyType">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="library"/>
        <xsd:enumeration value="cepLibrary"/>
        <xsd:enumeration value="component"/>
        <xsd:enumeration value="action"/>
    </xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="Dependency">
    <xsd:attribute name="type" type="DependencyType" use="required"/>
    <xsd:attribute name="name" type="xsd:string" use="required"/>
    <xsd:attribute name="additional" type="xsd:string" use="optional"/>
</xsd:complexType>

<xsd:complexType name="Dependencies">
    <xsd:sequence>
        <xsd:element name="dependency" type="Dependency" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>


<xsd:complexType name="ActionExtension">
    <xsd:sequence>
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="description" type="xsd:string"/>
        <xsd:element name="actions" type="Actions"/>
        <xsd:element name="dependencies" type="Dependencies" minOccurs="0" />
    </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ActionExtensions">
    <xsd:sequence>
        <xsd:element name="actionExtension" type="ActionExtension" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>
<!-- Applications.xsd -->
<!-- Application.xsd -->


<xsd:complexType name="Application">
    <xsd:sequence>
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="description" type="xsd:string"/>
        <xsd:element name="directoryName" type="DirectoryName"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="Applications">
    <xsd:sequence>
        <xsd:element name="application" type="Application" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>
<!-- ComponentExtensions.xsd -->
<!-- ComponentExtension.xsd -->
<!-- Components.xsd -->
<!-- Component.xsd -->

<!-- Representation.xsd -->
<xsd:simpleType name="Representation">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="Image"/>
        <xsd:enumeration value="Mesh"/>
        <xsd:enumeration value="None"/>
    </xsd:restriction>
</xsd:simpleType>


<xsd:complexType name="Component">
    <xsd:sequence>
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="description" type="xsd:string"/>
        <xsd:element name="representation" type="Representation"/>
        <xsd:element name="properties" type="Parameters" minOccurs="0"/>
        <xsd:element name="fileSuffix" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="Components">
    <xsd:sequence>
        <xsd:element name="component" type="Component" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ComponentExtension">
    <xsd:sequence>
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="description" type="xsd:string"/>
        <xsd:element name="components" type="Components"/>
        <xsd:element name="dependencies" type="Dependencies" minOccurs="0" />
    </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ComponentExtensions">
    <xsd:sequence>
        <xsd:element name="componentExtension" type="ComponentExtension" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>
<!-- Libraries.xsd -->
<!-- Library.xsd -->



<xsd:complexType name="Library">
    <xsd:sequence>
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="description" type="xsd:string"/>
        <xsd:element name="dependencies" type="Dependencies" minOccurs="0" />
    </xsd:sequence>
    <xsd:attribute name="static" type="xsd:boolean" default="true"/>
</xsd:complexType>

<xsd:complexType name="Libraries">
    <xsd:sequence>
        <xsd:element name="library" type="Library" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:element name="cep" type="Cep"/>
<xsd:complexType name="Cep">
    <xsd:sequence>
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="contact" type="Contact"/>
        <xsd:element name="description" type="xsd:string"/>
        <xsd:element name="readme" type="xsd:string" minOccurs="0"/>
        <xsd:element name="copyright" type="xsd:string" minOccurs="0"/>

        <xsd:element name="actionExtensions" type="ActionExtensions" minOccurs="0"/>
        <xsd:element name="applications" type="Applications" minOccurs="0"/>
        <xsd:element name="componentExtensions" type="ComponentExtensions" minOccurs="0"/>
        <xsd:element name="libraries" type="Libraries" minOccurs="0"/>
    </xsd:sequence>
</xsd:complexType>
</xsd:schema>
