<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <xsd:element name="Envio">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Version" type="xsd:string">
          <xsd:annotation>            
            <xsd:documentation xml:lang="es">
              Versión del esquema utilizado. Para PMP debe tomar el valor 1.0.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
          
        <xsd:element name="Ambito">          
          <xsd:annotation>
            <xsd:documentation xml:lang="es">
              Ámbito de los datos enviados. Para PMP debe tomar el valor EELL
            </xsd:documentation>
          </xsd:annotation>
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="CCAA"/>
              <xsd:enumeration value="EELL"/>
              <xsd:enumeration value="Otros"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Aplicacion" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation xml:lang="es">
              Nombre de la aplicación a la que pertenecen los datos. Para PMP debe tomar el valor PMP.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>          
        <xsd:element name="FechaGeneracion" type="xsd:dateTime" />
        <xsd:element name="SoftwareGeneracion" type="xsd:string" minOccurs="0" />

        <xsd:element ref="InformeCorporacion" maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element> 

  <xsd:element name="InformeCorporacion">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="Periodo" />
        <xsd:element ref="InformePMP" maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="InformePMP" >
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="CodigoEnte"/>
        <xsd:element name="NombreEnte" type="xsd:string" minOccurs="0"/>        
        <xsd:element ref="DatoPMP"/>        
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="Periodo">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Ejercicio">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:length value="4"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>

        <xsd:choice minOccurs="0">
          <xsd:element name="Trimestre">
            <xsd:simpleType>
              <xsd:restriction base="xsd:integer">
                <xsd:minInclusive value="1"/>
                <xsd:maxInclusive value="4"/>
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:element>
          <xsd:element name="Mes">
            <xsd:simpleType>
              <xsd:restriction base="xsd:integer">
                <xsd:minInclusive value="1"/>
                <xsd:maxInclusive value="12"/>
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:element>
        </xsd:choice>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="CodigoEnte">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="CodigoComunidad">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:length value="2"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="CodigoProvincia">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:length value="2"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="CodigoCorporacion">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:length value="3"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Tiporg1">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:length value="1"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Tiporg2">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:length value="1"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Tiporg3">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:length value="3"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
    
  
  <xsd:element name="DatoPMP">            
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="RatioOperacionesPagadas" type="xsd:decimal">
          <xsd:annotation>
            <xsd:documentation xml:lang="es">
              Ratio de operaciones pagadas en días
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="ImportePagosRealizados" type="xsd:decimal">
          <xsd:annotation>
            <xsd:documentation xml:lang="es">
              Importe de los pagos realizados en euros
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>          
        <xsd:element name="RatioOperacionesPendientes" type="xsd:decimal">
          <xsd:annotation>
            <xsd:documentation xml:lang="es">
              Ratio de operaciones pendientes en días
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="ImportePagosPendientes" type="xsd:decimal">
          <xsd:annotation>
            <xsd:documentation xml:lang="es">
              Importe de los pagos pendientes en euros
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="Observaciones">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">              
              <xsd:maxLength value="1000"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
