﻿<?xml version="1.0" encoding="utf-8"?>
<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="TRSDataTypes.xsd"/>
  <!-- 
********************************************************************
OTC DERIVATIVE TRANSACTION RECORD TYPE
************************************************************************
-->
  <xs:complexType name="OTCTransactionRecordInfoCompleteDescriptionType">
    <xs:annotation>
      <xs:documentation>
        OTC DERIVATIVE TRANSACTION RECORD TYPE

        TradingDay: Mandatory Field. ISO 8601 Extended Date Format
        (YYYY-MM-DD). Indicates the trading day on which the
        transaction was executed.

        TradingTime: Mandatory Field. The time at which the
        transaction was executed.

        BuySellIndicator: Mandatory Field. Identifies whether the
        transaction was a buy or sell from the perspective of the
        reporting investment firm or from the perspective of the client.

        TradingCapacity: Mandatory Field. Identifies whether the firm
        executed the transaction on its own account (either on its
        own behalf or on behalf of a client) or for the account on
        behalf of a client. The complex structure of this element is
        being described in the TRSDataTypes.xsd schema.

        OTCInstrumentIdentification: Mandatory field. Contains the six
        characteristics of the contract and optionaly the Instrument Identifier.

        UnitPrice: Mandatory Field. It express whether :
        - The price in percentage or
        - The unit price of a security or
        - The price of one derivative contract in case of derivatives on
        securities

        PriceNotation: Mandatory Field. ISO 4217 - Currency Code.

        Quantity: Mandatory Field. The number of units of the financial
        instrument, the number of units of the nominal value of bonds, or the number of derivative contracts included in the transaction.

        Counterparty: The complex structure of this element is being described
        in the TransactionRecordTypes.xsd schema.

        Client: The complex structure of this element is
        being described in the TRSDataTypes.xsd schema.

        TradingVenueCode: Mandatory Field. The complex structure of this element is
        being described in the TransactionRecordTypes.xsd schema.

        TransactionReferenceNumber: Mandatory Field. A unique identification
        number for the transaction provided by the investment firm
        or a third party reporting on its behalf.

        See TransactionRecordTypes.xsd XML-Schema File for further
        information.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="TransactionReferenceNumber" type="TransactionReferenceNumberType"/>
      <xs:element name="TradingTimestamp" type="xs:dateTime"/>
      <xs:element name="BuySellIndicator" type="BuySellIndicatorType"/>
      <xs:element name="TradingCapacity" type="LocalTradingCapacityType" />
      <xs:element name="OTCInstrumentIdentification" type="LocalOTCInstrumentIdentificationType"/>
      <xs:element name="UnitPrice" type="UnitPriceCompleteDescriptionType"/>
      <xs:element name="PriceNotation" type="CurrencyCodeType"/>
      <xs:element name="Quantity" type="QuantityType"/>
      <xs:element name="CounterParty" type="CounterpartyCompleteDescriptionType"/>
      <xs:element name="TradingVenueCode" type="OTCTradingVenueCodeType"/>
      <xs:element name="Client" type="ClientType" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>
  <!--	
**********************************************************************************
	CANCELLATION RECORD INFO TYPE
**********************************************************************************
-->
  <xs:complexType name="CancellationRecordInfoType">
    <xs:annotation>
      <xs:documentation>
        CANCELLATION RECORD INFO TYPE

        CancelledTransactionUniqueIdentifier: Univocally identifies the
        transaction to cancel among the transactions sent by this CA.

        CancelledTransactionFlag: Mandatory Field. C (cancelled by the
        Reporting Firm).

      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="CancelledTransactionUniqueIdentifier" type="UniqueTransactionIdentifierType"/>
      <xs:element name="CancelledTransactionFlag" type="LocalCancelledTransactionFlagType"/>
    </xs:sequence>
  </xs:complexType>
  <!-- REPORTING PARTY complex type -->
  <xs:complexType name="ReportingPartyType">
    <xs:annotation>
      <xs:documentation>
        ReportingPartyType extends PartyType (TRSDataTypes.xsd)
        
        OTCTransactionRecordInfo: contains data related to the OTC derivatives transactions
        associated to a Financial Instrument. See TransactionRecordTypes.xsd
        XML-Schema Files for further information.

        CancellationRecordInfo: contains the unique identifier for the
        transaction to be cancelled by the CA.
        See CancellationRecordTypes.xsd XML-Schema Files for
        further information.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="PartyType">
        <xs:sequence>
          <xs:element name="OTCTransactionRecordInfo" type="OTCTransactionRecordInfoCompleteDescriptionType" minOccurs="0" maxOccurs="unbounded" />
          <xs:element name="CancellationRecordInfo" type="CancellationRecordInfoType" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <!-- OTC Transaction schema -->
  <xs:element name="Report" >
    <xs:annotation>
      <xs:documentation>
        Root element of the schema. 
        Exactly one TechnicalReportingParty defined by PartyType (TRSDataTypes.xsd)
        At least one but possible several records of ReportingParties
        ReportingParty is defined by ReportingPartyType
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="TechnicalReportingParty" type="PartyType" />
        <xs:element name="ReportingParties">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ReportingParty" type="ReportingPartyType" minOccurs="1" maxOccurs="unbounded"  />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>        
      <xs:attribute name="Version" type="xs:string" use="required" fixed="3.0"/>
    </xs:complexType>    
    <xs:unique name="uniqueIdReportingParty">
      <xs:selector xpath="ReportingParties/*"/>
      <xs:field xpath="@Identification"/>
    </xs:unique>
  </xs:element>
</xs:schema>

