﻿<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0"
>
  <xs:include schemaLocation="TREM_TransactionRecordTypes3.0.xsd"/>
  <xs:include schemaLocation="StandardDataTypes1.0.xsd"/>
 <!--  <xs:include schemaLocation="TREM_ErrorsInfoTypes3.0.xsd"/>-->
  <!--  String with a max length of 11 -->
  <xs:simpleType name="StringType11">
    <xs:annotation>
      <xs:documentation>Format: max 11(x)</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:minLength value="1"></xs:minLength>
      <xs:maxLength value="11"></xs:maxLength>
      <xs:pattern	value="[^¤]*"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- String with a max length of 20 -->
  <xs:simpleType name="StringType20">
    <xs:annotation>
      <xs:documentation>Format: max 20(x)</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:minLength value="1"></xs:minLength>
      <xs:maxLength value="20"></xs:maxLength>
      <xs:pattern	value="[^¤]*"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- String with a max length of 70 -->
  <xs:simpleType name="StringType70">
    <xs:annotation>
      <xs:documentation>Format: max 70(x)</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:minLength value="1"></xs:minLength>
      <xs:maxLength value="70"></xs:maxLength>
      <xs:pattern	value="[^¤]*"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- String with a max length of 70 -->
  <xs:simpleType name="StringType90">
    <xs:annotation>
      <xs:documentation>Format: max 90(x)</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:minLength value="1"></xs:minLength>
      <xs:maxLength value="90"></xs:maxLength>
      <xs:pattern	value="[^¤]*"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- LOCAL TRADING CAPACITY type-->
  <xs:simpleType name="LocalTradingCapacityType">
    <xs:annotation>
      <xs:documentation>
        P =  Own account / portfolio.
        M = Market maker.
        C = Own account as agent for a customer.
        W = Warehousing.
        For the account, and on behalf, of a client:
        A = Agent.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="P"/>
      <xs:enumeration value="M"/>
      <xs:enumeration value="C"/>
      <xs:enumeration value="W"/>
      <xs:enumeration value="A"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- LOCAL CANCELLED TRANSACTION FLAG type-->
  <xs:simpleType name="LocalCancelledTransactionFlagType">
    <xs:annotation>
      <xs:documentation>
        C: cancelled by the Reporting Firm
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:whiteSpace value="collapse"/>
      <xs:pattern value="C"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- File status -->
  <xs:simpleType name="FileStatusType">
    <xs:annotation>
      <xs:documentation>
        AWE = Accepted With Errors
        ACC = Accepted
        REJ = Rejected
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="ACC"/>
      <xs:enumeration value="AWE"/>
      <xs:enumeration value="REJ"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- Transaction status -->
  <xs:simpleType name="TransactionStatusType">
    <xs:annotation>
      <xs:documentation>
        Transaction status types:
        ACCEPTED = Transaction is accepted.
        FAILED = Transaction has failed. See Reason-element for error details.
        IGNORED = Transaction is ignored.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="ACCEPTED"/>
      <xs:enumeration value="FAILED"/>
      <xs:enumeration value="IGNORED"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- PARTY complex type-->
  <xs:complexType name="PartyType">
    <xs:annotation>
      <xs:documentation>
        A party is identified by its BICCode
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="Identification" type="BICCodeType" use="required" />
  </xs:complexType>
  <!-- CLIENT complex type-->
  <xs:complexType name="ClientType">
    <xs:annotation>
      <xs:documentation>
        Additional elements in local transaction reporting describing a client
        ClientCode: it can be either empty, a BIC code or an Internal Code. The complex structure is defined in TREM_TransactionRecordTypes3.0.xsd
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ClientCode" type="ClientCompleteDescriptionType"/>
      <xs:element name="ClientName" type="StringType70" minOccurs="0" />
      <xs:element name="ClientIdentificationLocal" type="StringType20" minOccurs="0" />
      <xs:element name="ClientStreet" type="StringType70" minOccurs="0" />
      <xs:element name="ClientZipCode" type="StringType70" minOccurs="0" />
      <xs:element name="ClientCity" type="StringType70" minOccurs="0" />
      <xs:element name="ClientCountry" type="StringType70" minOccurs="0" />
      <xs:element name="ProxyHolder" type="StringType11" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="LocalOTCInstrumentIdentificationType" >
    <xs:complexContent>
      <xs:extension base="OTCInstrumentIdentificationType">
        <xs:sequence>
          <xs:element name="InstrumentDescription" type="StringType90" minOccurs="0" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <!--<xs:complexType name="OriginalFileNameType">
    <xs:attribute name="FileName" type="xs:string" use="required"/>
    <xs:attribute name="ReceivedTimestamp" type="xs:dateTime" use="required"/>
  </xs:complexType>
  <xs:complexType name="LocalTransactionErrorCompleteDescriptionType">
    <xs:sequence>
      <xs:element name="TransactionError" type="LocalTransactionErrorType" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="LocalTransactionErrorType">
    <xs:complexContent>
      <xs:extension base="TransactionErrorType">
        <xs:sequence>
          <xs:element name="Status" type="TransactionStatusType" />
          <xs:element name="Reasons" minOccurs="0" >
            <xs:complexType>
              <xs:sequence>
                <xs:element name="Reason" type="xs:token" minOccurs="1" maxOccurs="unbounded" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:sequence>      
      </xs:extension>
    </xs:complexContent>  
  </xs:complexType>
  <xs:complexType name="ErrorInfoCompleteDescriptionType">
    <xs:annotation>
      <xs:documentation>
        ErrorsInfoCompleteDescriptionType: errors will be managed
        using two types of error records: file and transaction.
        See ErrorsInfoTypes.xsd for more details.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="FileErrorRecords" type="FileErrorCompleteDescriptionType" minOccurs="0"/>
      <xs:element name="TransactionErrorRecords" type="LocalTransactionErrorCompleteDescriptionType" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>-->
</xs:schema>

