<?xml version="1.0" encoding="UTF-8"?>
<!-- 
(C) KDPW S.A.
Company: KDPW
Unit: KDPW_TR
System: kdpw_stream
Message name: auth.rlt.001.02
Description: SFTR - Message used to define relations between RSE and ERRs
Creation date: 2020-04-02
Last changed: 2024-04-22
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:kdpw:xsd:auth.rlt.001.02" targetNamespace="urn:kdpw:xsd:auth.rlt.001.02" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:annotation>
    <xs:documentation source="Name" xml:lang="EN">SFTR - Entity relations message</xs:documentation>
    <xs:documentation source="Definition" xml:lang="EN">SFTR -Message used to define relations between RSE and RCs</xs:documentation>
  </xs:annotation>
  <xs:element name="Document" type="Document">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Document</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Document</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="ClientReferenceData">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Client data</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Client reference data</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="RcId" type="LEIIdentifier">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Counterparty id</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Unique code identifying the counterparty</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EmailAdr" type="EmailAddress" minOccurs="0">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Email address</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Email address.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RcNtr" type="CounterpartyNature">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Counterparty nature</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Nature of the counterparty</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RcRelTp" type="RCRelationType" minOccurs="0">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">RC relation type</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">RC relation type</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="CounterpartyNature">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Counterparty nature</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Counterparty nature</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:choice>
        <xs:element name="RcFcNtr" type="FinancialNature">
          <xs:annotation>
            <xs:documentation source="Name" xml:lang="EN">Financial counterparty</xs:documentation>
            <xs:documentation source="Definition" xml:lang="EN">Financial counterparty</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="RcNfcNtr" type="NonFinancialNature">
          <xs:annotation>
            <xs:documentation source="Name" xml:lang="EN">Nonfinancial counterparty</xs:documentation>
            <xs:documentation source="Definition" xml:lang="EN">Nonfinancial counterparty</xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="CounterPartyNonfinancialTypeCode">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Party type code</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Party type code</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="SME">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Nonfinancial minus</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Nonfinancial minus</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="LRG">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Nonfinancial plus</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Nonfinancial plus</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="Document">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Document</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Document</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="RltnDataMsg" type="EntityRelationsDataMessage">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Entity relations message</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Entity relations message</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="EmailAddress">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">EmailAddress</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Email address</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="256"/>
      <xs:pattern value="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="EntityRelationsData">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Client data</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Client data</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="TechRcrdId" type="Max140Text">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Technical Record Id </xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Technical Record Id </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:choice>
        <xs:element name="New" type="ClientReferenceData">
          <xs:annotation>
            <xs:documentation source="Name" xml:lang="EN">New client data</xs:documentation>
            <xs:documentation source="Definition" xml:lang="EN">New client data</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="Cxl" type="RelationCancellationData">
          <xs:annotation>
            <xs:documentation source="Name" xml:lang="EN">Relation cancellation</xs:documentation>
            <xs:documentation source="Definition" xml:lang="EN">Relation cancellation</xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="EntityRelationsDataMessage">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Entity relations message</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Entity relations message</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="GnlInf" type="GeneralInformation">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">General information</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">General information</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="RltnData" type="EntityRelationsData" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Relations</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Relations</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="FinancialNature">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Financial nature</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Financial nature</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="RcIsFund" type="YesNoIndicator">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">RC is investment fund</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">RC is investment fund</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="GeneralInformation">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">General information</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">General information</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="RptSubmitgNtty" type="LEIIdentifier">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Report submitting entity Id</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Report submitting entity Id</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="ISODate">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">ISODate</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">ISO date</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:date"/>
  </xs:simpleType>
  <xs:simpleType name="LEIIdentifier">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">LEIIdentifier</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Legal Entity Identifier is a code allocated to a party as described in ISO 17442 "Financial Services - Legal Entity Identifier (LEI)".</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:pattern value="[A-Z0-9]{18,18}[0-9]{2,2}"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="Max140Text">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Max140Text</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Specifies a character string with a maximum length of 140 characters.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:minLength value="1"/>
      <xs:maxLength value="140"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="NonFinancialNature">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Nonfinancial nature</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Nonfinancial nature</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="RcNfcNtrCd" type="CounterPartyNonfinancialTypeCode">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Nonfinancial counterparty nature</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Nonfinancial counterparty nature </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="RCRelationType">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Relation Type between RC and RSE</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Relation Type between RC and RSE</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:choice>
        <xs:element name="RcMngFund" type="YesNoIndicator">
          <xs:annotation>
            <xs:documentation source="Name" xml:lang="EN">RC is investment funds managed by RSE or by Entity from capital group</xs:documentation>
            <xs:documentation source="Definition" xml:lang="EN">RC is investment funds managed by RSE or by Entity from capital group</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="RcCptlGrp" type="YesNoIndicator">
          <xs:annotation>
            <xs:documentation source="Name" xml:lang="EN">RC belongs to the same capital group as RSE </xs:documentation>
            <xs:documentation source="Definition" xml:lang="EN">RC belongs to the same capital group as RSE </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="RelationCancellationData">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">Relation cancellation</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Relation cancellation</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="RcId" type="LEIIdentifier">
        <xs:annotation>
          <xs:documentation source="Name" xml:lang="EN">Counterparty id</xs:documentation>
          <xs:documentation source="Definition" xml:lang="EN">Unique code identifying the counterparty</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="YesNoIndicator">
    <xs:annotation>
      <xs:documentation source="Name" xml:lang="EN">YesNoIndicator</xs:documentation>
      <xs:documentation source="Definition" xml:lang="EN">Indicates a "Yes" or "No" type of answer for an element.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:boolean"/>
  </xs:simpleType>
</xs:schema>