<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.bankitalia.it/bolina/common/vo/message" 
           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
           xmlns:msg="http://www.bankitalia.it/bolina/common/vo/message" 
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:x4bisf="http://www.bankitalia.it/bolina/common/vo/cube" 
           elementFormDefault="qualified">
    <xs:import schemaLocation="cube.xsd" namespace="http://www.bankitalia.it/bolina/common/vo/cube"></xs:import>
    <xs:element name="message" type="msg:MessageType">
    </xs:element>

    <xs:complexType name="MessageType">
    	<xs:sequence>
    		<xs:element name="header" type="msg:HeaderType" minOccurs="1" maxOccurs="1"></xs:element>
    		<xs:element name="content" type="msg:ContentType" minOccurs="1" maxOccurs="1"></xs:element>
    	</xs:sequence>
    </xs:complexType>

    <xs:complexType name="HeaderType">
    	<xs:annotation>
        	<xs:documentation>
        		timeProduction format: yyyy-mm-dd hh24:mi:ss
        	</xs:documentation>
        </xs:annotation>
		<xs:sequence>
    		<xs:element name="survey" type="xs:string"></xs:element>
    		<xs:element name="partner" type="xs:string"></xs:element>
    		<xs:element name="initialDate" type="xs:date"></xs:element>
    		<xs:element name="timeProduction" type="xs:string"></xs:element>
    		<xs:element name="type">
    			<xs:simpleType>
    				<xs:restriction base="xs:string">
    					<xs:enumeration value="SUBSTITUTION"></xs:enumeration>
    					<xs:enumeration value="INTEGRATION"></xs:enumeration>
    				</xs:restriction>
    			</xs:simpleType>
    		</xs:element>
    	</xs:sequence>
    </xs:complexType>
   
    <xs:complexType name="ContentType">
        <xs:annotation>
        	<xs:documentation>
        		In dims and segment elements some dimension name could
        		be equal! Remember to verify the uniqueness when you
        		parse a document compliant with this schema!
        	</xs:documentation>
        </xs:annotation>
        <xs:sequence>
        	<xs:element name="dim" type="x4bisf:DimensionType"
        		minOccurs="0" maxOccurs="unbounded">
        	</xs:element>
        	<xs:element name="dataSegment" type="x4bisf:SegmentType"
        		minOccurs="0" maxOccurs="3">
        	</xs:element>
        	<xs:element name="confirmSegment" type="msg:ConfirmSegmentType" minOccurs="0" maxOccurs="1"></xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="ConfirmSegmentType">
		<xs:sequence>
			<xs:element name="confirm" type="msg:ConfirmType" minOccurs="1" maxOccurs="unbounded"></xs:element>
		</xs:sequence>
    </xs:complexType>


    <xs:complexType name="ConfirmType">
    	<xs:attribute name="id" type="xs:string"></xs:attribute>
    	<xs:attribute name="description" type="xs:string"></xs:attribute>
    </xs:complexType>
</xs:schema>