<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="http://projets.admisource.gouv.fr/xemelios/technical/schemas/xsd2html.xsl"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="2.0">
  <xs:include schemaLocation="namespace.xsd"/>
  <xs:element name="controls">
    <xs:complexType>
      <xs:sequence>
      	<xs:element name="Message" maxOccurs="1"/>
        <xs:element name="document" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <!--xs:element name="namespaces" type="TNamespace" maxOccurs="1"/-->
              <xs:element name="param" type="Tparam" minOccurs="0" maxOccurs="unbounded"/>
              <xs:element name="controlTech" type="TcontrolTech" minOccurs="0" maxOccurs="2"/>
              <xs:element name="control" type="Tcontrol" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="id" type="xs:string"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:complexType name="Tparam">
    <xs:choice>
      <xs:element name="input" type="Tinput"/>
      <xs:element name="select" type="Tselect"/>
    </xs:choice>
    <xs:attribute name="id" type="xs:string"/>
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="datatype" type="TDataType"/>
    <xs:attribute name="use" use="optional" default="optional">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="required"/>
          <xs:enumeration value="optional"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>
  
  <xs:complexType name="Tselect">
      <xs:sequence>
        <xs:element name="option" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType mixed="true">
            <xs:attribute name="value" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    <xs:attribute name="id" use="required"/>
    <!--xs:attribute name="libelle" use="optional"/-->
    <!--xs:attribute name="sort" use="optional"/-->
    <xs:attribute name="multivalued" use="optional" type="xs:boolean" default="false"/>
    <xs:attribute name="editable" use="optional" type="xs:boolean" default="false"/>
  </xs:complexType>
  <xs:complexType name="Tinput">
    <xs:attribute name="id" type="xs:ID" use="required"/>
    <xs:attribute name="datatype" type="TDataType"/>
    <xs:attribute name="xml-format" type="xs:string" use="optional"/>
  </xs:complexType>
  <xs:complexType name="Tcontrol">
    <xs:sequence>
      <xs:element name="regle-fonctionnelle" type="xs:string"/>
      <xs:element name="refId" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="param" type="xs:string"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="message-echec" type="xs:string"/>
      <!--xs:element name="element-lie" type="xs:string"/-->
    </xs:sequence>
    <xs:attribute name="id"/>
    <xs:attribute name="libelle"/>
    <xs:attribute name="severity" type="TSeverity" use="required"/>
    <xs:attribute name="class" use="required"/>
  </xs:complexType>
  <xs:complexType name="TcontrolTech">
    <xs:sequence>
      <xs:element name="paramTech" type="TParamTech" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="id" use="required"/>
    <xs:attribute name="libelle" use="required"/>
    <xs:attribute name="severity" type="TSeverity" use="required"/>
  </xs:complexType>
  <xs:complexType name="TParamTech">
    <xs:attribute name="id" type="xs:string" use="required"/>
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="value" type="xs:string"  use="required"/>
  </xs:complexType>
  <xs:simpleType name="TSeverity">
    <xs:restriction base="xs:string">
      <xs:enumeration value="BLOQUANT"/>
      <xs:enumeration value="FORCABLE"/>
      <xs:enumeration value="NON FORCABLE"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="TDataType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="string"/>
      <xs:enumeration value="integer"/>
      <xs:enumeration value="boolean"/>
      <xs:enumeration value="decimal"/>
      <xs:enumeration value="date"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>
