<?xml version="1.0" encoding="UTF-8" ?>

<schema targetNamespace="https://www.gopay.cz/clearing/v2"
	elementFormDefault="qualified"
	attributeFormDefault="unqualified"
	xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:xs="https://www.gopay.cz/clearing/v2">

	<!-- =======================================================================
	Verze 2 schématu IFPP clearingu (vyúčtování s detailem interchange / association / other fee komponent).

	Klíčové změny oproti v1 (https://www.gopay.cz/clearing):
	  - targetNamespace                  = .../clearing/v2
	  - <stornoMovement>                 → sjednoceno na <movement>
	  - <paymentChannel><movements>      → wrapper odstraněn (přímí potomci <movement>)
	  - amountTransfer                   → odstraněno
	  - amountKBonus → amountCompensationBonus (a *KBonusReversal → *CompensationBonusReversal)
	  - amountAdministrationFeeReturned  → amountAdministrationFeeReversal (a obdobně KBonus, Lemonero)
	  - amountHoldonOut/In               → amountHoldonDebit/Credit
	  - counterpartyName                 → counterparty
	  - Signed amount globálně            — všechny fee a amount atributy v hlavičce, v <paymentChannel>
	                                       i per-<movement> nesou znaménko (debit ⇒ záporné,
	                                       credit ⇒ kladné)
	  - period                           → formát YYYYMM (např. "202604")

	Nové elementy s per-řádkovým detailem skupin:
	  <administrationFee>, <compensationBonus>, <lemonero>,
	  <accountUpdate>, <emvFee>, <holdon>
	Nové per-movement atributy u <accountUpdate>: relatedId + relatedType
	  (polymorfní vazba na business entitu, ke které se aktualizace karty týká).

	Rozdíl vůči BLEND v2:
	  - <paymentChannel>      → fee komponenty: interchangeFee, associationFee, otherPercentFee, otherTransactionFee
	                            (místo BLEND volumeFee/transactionFee)
	  - per-<movement>        → totéž
	  - <clearing> hlavička   → navíc agregáty: interchangeFee, associationFee, otherPercentFee, otherTransactionFee

	Konvence znamének (perspective = sellerův účet):
	  - debit  (peníze odchází)  ⇒ amount < 0
	  - credit (peníze přicházejí) ⇒ amount > 0
	======================================================================= -->

	<!-- =====================================================================
	     ROOT
	===================================================================== -->

	<element name="clearing" nillable="false" type="xs:Clearing"/>

	<complexType name="Clearing">
		<annotation><documentation>Dokument popisující vyúčtování (clearing) v2 — IFPP varianta s detailem fee komponent (interchange, association, other percent, other transaction).</documentation></annotation>
		<sequence>
			<element name="paymentChannel"    type="xs:PaymentChannel"    minOccurs="0" maxOccurs="unbounded"/>
			<element name="storno"            type="xs:Storno"            minOccurs="0"/>
			<element name="creditNote"        type="xs:CreditNote"        minOccurs="0"/>
			<element name="sellerDeposit"     type="xs:SellerDeposit"     minOccurs="0"/>
			<element name="administrationFee" type="xs:AdministrationFee" minOccurs="0"/>
			<element name="compensationBonus" type="xs:CompensationBonus" minOccurs="0"/>
			<element name="lemonero"          type="xs:Lemonero"          minOccurs="0"/>
			<element name="accountUpdate"     type="xs:AccountUpdate"     minOccurs="0"/>
			<element name="emvFee"            type="xs:EmvFee"            minOccurs="0"/>
			<element name="holdon"            type="xs:Holdon"            minOccurs="0"/>
		</sequence>

		<!-- Identifikace clearingu -->
		<attribute name="clearingId" type="long" use="required">
			<annotation><documentation>Unikátní ID clearingu.</documentation></annotation>
		</attribute>
		<attribute name="accountId" type="long" use="required">
			<annotation><documentation>ID sellerova účtu.</documentation></annotation>
		</attribute>
		<attribute name="variableSymbol" type="string" use="required">
			<annotation><documentation>Variabilní symbol pro bankovní převod.</documentation></annotation>
		</attribute>
		<attribute name="accountName" type="string" use="required">
			<annotation><documentation>Lidsky čitelný název sellerova účtu (např. "Účet CZK").</documentation></annotation>
		</attribute>
		<attribute name="currency" type="string" use="required">
			<annotation><documentation>ISO 4217 měnový kód účtu (např. "CZK", "EUR", "USD"). Platí pro všechny amount* atributy v clearingu.</documentation></annotation>
		</attribute>

		<!-- Časová orientace -->
		<attribute name="dateClearedFrom" type="date" use="required">
			<annotation><documentation>Začátek účetního období (formát YYYY-MM-DD (ISO 8601), včetně).</documentation></annotation>
		</attribute>
		<attribute name="dateClearedTo" type="date" use="required">
			<annotation><documentation>Konec účetního období (formát YYYY-MM-DD (ISO 8601), včetně).</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum provedení vyúčtování (formát YYYY-MM-DD (ISO 8601)).</documentation></annotation>
		</attribute>
		<attribute name="performedBy" type="string" use="optional">
			<annotation><documentation>Iniciátor clearingu — "system" pro automatické vyúčtování, jinak login uživatele, který clearing vyvolal manuálně.</documentation></annotation>
		</attribute>
		<attribute name="scheduledClearing" type="boolean" use="required">
			<annotation><documentation>True = plánovaný (automatický) clearing, false = manuální (ad-hoc).</documentation></annotation>
		</attribute>

		<!-- Souhrnné částky (všechny signed, perspective = sellerův účet) -->
		<attribute name="amountPayment" type="double" use="required">
			<annotation><documentation>Hrubá suma plateb od zákazníků (gross). Nezahrnuje amountSellerDeposit.</documentation></annotation>
		</attribute>
		<attribute name="amountPaymentFee" type="double" use="required">
			<annotation><documentation>Celkový poplatek za zprostředkování plateb napříč všemi paymentChannely (signed, debit = záporné). Zahrnuje POUZE poplatky za platby na kanálech (= Σ totalFee všech paymentChannel = interchangeFee + associationFee + otherPercentFee + otherTransactionFee). NEzahrnuje amountFeeExternal ani side-movement agregáty (amountAdministrationFee, amountLemonero, amountCompensationBonus, …) — ty jsou samostatné amount* atributy hlavičky.</documentation></annotation>
		</attribute>
		<attribute name="amountFeeExternal" type="double" use="required">
			<annotation><documentation>Externí poplatek (banky / schémy) + skryté zaokrouhlení pro měny bez centů. Signed (debit = záporné).</documentation></annotation>
		</attribute>
		<attribute name="amountStorno" type="double" use="required">
			<annotation><documentation>Celková suma stornovaných plateb (signed, debit = záporné).</documentation></annotation>
		</attribute>
		<attribute name="amountStornoFee" type="double" use="required">
			<annotation><documentation>Celková suma stornovaných poplatků (signed, debit = záporné).</documentation></annotation>
		</attribute>
		<attribute name="amountCreditNote" type="double" use="required">
			<annotation><documentation>Celková vratka poplatku za zprostředkování plateb (dobropis). Obvykle 0.</documentation></annotation>
		</attribute>
		<attribute name="amountSellerDeposit" type="double" use="optional">
			<annotation><documentation>Navýšení zůstatku obchodního účtu z bankovních převodů sellera (signed, credit = kladné). Obvykle 0.</documentation></annotation>
		</attribute>

		<!-- IFPP-specific fee agregáty (signed) -->
		<attribute name="interchangeFee" type="double" use="required">
			<annotation><documentation>Agregát interchange fee (poplatek vydavatelské bance) napříč všemi paymentChannely. Signed (debit = záporné). Rozklad amountPaymentFee — platí: interchangeFee + associationFee + otherPercentFee + otherTransactionFee = amountPaymentFee.</documentation></annotation>
		</attribute>
		<attribute name="associationFee" type="double" use="required">
			<annotation><documentation>Agregát association fee (poplatek kartové asociaci Visa/MC) napříč všemi paymentChannely. Signed (debit = záporné). Rozklad amountPaymentFee.</documentation></annotation>
		</attribute>
		<attribute name="otherPercentFee" type="double" use="required">
			<annotation><documentation>Agregát ostatních procentních poplatků napříč všemi paymentChannely. Signed (debit = záporné). Rozklad amountPaymentFee.</documentation></annotation>
		</attribute>
		<attribute name="otherTransactionFee" type="double" use="required">
			<annotation><documentation>Agregát ostatních transakčních poplatků napříč všemi paymentChannely. Signed (debit = záporné). Rozklad amountPaymentFee.</documentation></annotation>
		</attribute>

		<!-- Side movement agregáty (iter. 1 v2) — všechny signed -->
		<attribute name="amountAdministrationFee" type="double" use="optional">
			<annotation><documentation>Agregát správních poplatků (MIN_FEE, GATE_FEE, ONETIME_FEE). Signed (debit = záporné).</documentation></annotation>
		</attribute>
		<attribute name="amountAdministrationFeeReversal" type="double" use="optional">
			<annotation><documentation>Agregát storna správních poplatků. Signed (credit = kladné).</documentation></annotation>
		</attribute>
		<attribute name="amountCompensationBonus" type="double" use="optional">
			<annotation><documentation>Agregát kompenzačních bonusů (např. KB věrnostní bonus). Signed (credit = kladné).</documentation></annotation>
		</attribute>
		<attribute name="amountCompensationBonusReversal" type="double" use="optional">
			<annotation><documentation>Agregát storna kompenzačních bonusů. Signed (debit = záporné).</documentation></annotation>
		</attribute>
		<attribute name="amountLemonero" type="double" use="optional">
			<annotation><documentation>Agregát splátek úvěru Lemonero. Signed (debit = záporné).</documentation></annotation>
		</attribute>
		<attribute name="amountLemoneroReversal" type="double" use="optional">
			<annotation><documentation>Agregát storna splátek Lemonero. Signed (credit = kladné).</documentation></annotation>
		</attribute>
		<attribute name="amountHoldonDebit" type="double" use="optional">
			<annotation><documentation>Agregát převodů na UNZ (Účet nevypořádaných zůstatků). Signed (debit = záporné).</documentation></annotation>
		</attribute>
		<attribute name="amountHoldonCredit" type="double" use="optional">
			<annotation><documentation>Agregát přijetí nespárované platby z UNZ. Signed (credit = kladné).</documentation></annotation>
		</attribute>
		<attribute name="amountAccountUpdateFee" type="double" use="optional">
			<annotation><documentation>Agregát poplatků za aktualizaci platebních karet. Signed (debit = záporné).</documentation></annotation>
		</attribute>
		<attribute name="amountEMVFee" type="double" use="optional">
			<annotation><documentation>Agregát poplatků za platby bez 3DS overení (EMV frictionless). Signed (debit = záporné).</documentation></annotation>
		</attribute>

		<!-- Výplata -->
		<attribute name="amountNetto" type="double" use="required">
			<annotation><documentation>Čistá vyplacená částka. Σ všech amount* atributů hlavičky (vč. amountPaymentFee a amountFeeExternal). Sčítají se POUZE atributy s prefixem amount*; rozklady NEsčítat zvlášť: interchangeFee/associationFee/otherPercentFee/otherTransactionFee jsou rozpad amountPaymentFee (ne další položky).</documentation></annotation>
		</attribute>
	</complexType>

	<!-- =====================================================================
	     PAYMENT CHANNEL (kartové i bankovní platby) — IFPP varianta s detailem IF/AF/otherP/otherT
	===================================================================== -->

	<complexType name="PaymentChannel">
		<annotation><documentation>Vyúčtování za jeden platební kanál (např. ch_eu_six, ch_cz_csas) s detailem interchange / association / other percent / other transaction fee.</documentation></annotation>
		<sequence>
			<element name="movement" type="xs:PaymentChannelMovement" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
		<attribute name="type" type="xs:PaymentChannelType" use="required">
			<annotation><documentation>Identifikátor platebního kanálu (např. ch_eu_six, ch_cz_csas, ch_cz_kb).</documentation></annotation>
		</attribute>
		<attribute name="totalFee" type="double" use="required">
			<annotation><documentation>Celkový poplatek za kanál (signed, debit = záporné). Suma interchange + association + otherPercent + otherTransaction fee.</documentation></annotation>
		</attribute>
		<attribute name="interchangeFee" type="double" use="optional">
			<annotation><documentation>Interchange fee za kanál (signed). Optional — pro non-card kanály typicky 0/absent.</documentation></annotation>
		</attribute>
		<attribute name="associationFee" type="double" use="optional">
			<annotation><documentation>Association fee za kanál (signed). Optional — pro non-card kanály typicky 0/absent.</documentation></annotation>
		</attribute>
		<attribute name="otherPercentFee" type="double" use="required">
			<annotation><documentation>Ostatní procentní poplatek za kanál (signed).</documentation></annotation>
		</attribute>
		<attribute name="otherTransactionFee" type="double" use="required">
			<annotation><documentation>Ostatní transakční poplatek za kanál (signed).</documentation></annotation>
		</attribute>
	</complexType>

	<complexType name="PaymentChannelMovement">
		<annotation><documentation>Peněžní pohyb na obchodním účtu — platba zprostředkovaná GoPay (IFPP varianta).</documentation></annotation>
		<attribute name="accountMovementId" type="long" use="required">
			<annotation><documentation>ID zdrojového pohybu pro účetní párování.</documentation></annotation>
		</attribute>
		<attribute name="type" type="xs:PaymentChannelMovementType" use="required">
			<annotation><documentation>Účetní typ pohybu: credit (peníze přicházejí, +) nebo debit (peníze odchází, −).</documentation></annotation>
		</attribute>
		<attribute name="amount" type="double" use="required">
			<annotation><documentation>Hrubá částka platby (gross). Signed.</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum provedení platby (YYYY-MM-DD (ISO 8601)).</documentation></annotation>
		</attribute>
		<attribute name="counterparty" type="string" use="optional">
			<annotation><documentation>Identifikace protistrany: maskovaný PAN karty nebo IBAN/číslo účtu.</documentation></annotation>
		</attribute>
		<attribute name="eshopGoId" type="long" use="required">
			<annotation><documentation>GoPay ID e-shopu, ke kterému platba patří.</documentation></annotation>
		</attribute>
		<attribute name="orderId" type="string" use="optional">
			<annotation><documentation>Variabilní symbol / order ID z platby.</documentation></annotation>
		</attribute>
		<attribute name="paymentSessionId" type="long" use="optional">
			<annotation><documentation>GoPay ID původní platební session.</documentation></annotation>
		</attribute>
		<attribute name="interchangeFee" type="double" use="optional">
			<annotation><documentation>Interchange fee za tuto platbu (signed). Optional — jen u kartových plateb.</documentation></annotation>
		</attribute>
		<attribute name="associationFee" type="double" use="optional">
			<annotation><documentation>Association fee za tuto platbu (signed). Optional — jen u kartových plateb.</documentation></annotation>
		</attribute>
		<attribute name="otherPercentFee" type="double" use="required">
			<annotation><documentation>Ostatní procentní poplatek za tuto platbu (signed).</documentation></annotation>
		</attribute>
		<attribute name="otherTransactionFee" type="double" use="required">
			<annotation><documentation>Ostatní transakční poplatek za tuto platbu (signed).</documentation></annotation>
		</attribute>
		<attribute name="nettoAmount" type="double" use="required">
			<annotation><documentation>Čistá částka = amount + interchangeFee + associationFee + otherPercentFee + otherTransactionFee (suma signed hodnot).</documentation></annotation>
		</attribute>
	</complexType>

	<simpleType name="PaymentChannelMovementType">
		<restriction base="string">
			<enumeration value="credit"/>
			<enumeration value="debit"/>
		</restriction>
	</simpleType>

	<simpleType name="PaymentChannelType">
		<restriction base="string">
			<enumeration value="ch_cz_gopay"/>
			<enumeration value="ch_cz_supercash"/>
			<enumeration value="ch_eu_mb_w"/>
			<enumeration value="ch_eu_mb_a"/>
			<enumeration value="ch_eu_mb_b"/>
			<enumeration value="ch_cz_gp_c"/>
			<enumeration value="ch_cz_gp_u"/>
			<enumeration value="ch_cz_gp_kb"/>
			<enumeration value="ch_eu_six"/>
			<enumeration value="ch_eu_om"/>
			<enumeration value="ch_eu_cg"/>
			<enumeration value="ch_cz_cs_card2"/>
			<enumeration value="ch_cz_kb"/>
			<enumeration value="ch_cz_rb"/>
			<enumeration value="ch_cz_mb"/>
			<enumeration value="ch_cz_pmw_vb"/>
			<enumeration value="ch_cz_pmw_fb"/>
			<enumeration value="ch_cz_pmw_ge"/>
			<enumeration value="ch_cz_csas"/>
			<enumeration value="ch_cz_uni"/>
			<enumeration value="ch_cz_era"/>
			<enumeration value="ch_cz_csob"/>
			<enumeration value="ch_sk_uni"/>
			<enumeration value="ch_sk_sp"/>
			<enumeration value="ch_sk_csob"/>
			<enumeration value="ch_sk_pabank"/>
			<enumeration value="ch_sk_tatrabank"/>
			<enumeration value="ch_sk_vubbank"/>
			<enumeration value="ch_pl_getbank"/>
			<enumeration value="ch_pl_getinonline"/>
			<enumeration value="ch_pl_blik"/>
			<enumeration value="ch_pl_noble"/>
			<enumeration value="ch_pl_millennium"/>
			<enumeration value="ch_pl_bos"/>
			<enumeration value="ch_pl_pekao"/>
			<enumeration value="ch_pl_sgb"/>
			<enumeration value="ch_pl_bnp"/>
			<enumeration value="ch_pl_wbk"/>
			<enumeration value="ch_pl_agricole"/>
			<enumeration value="ch_pl_deutsche"/>
			<enumeration value="ch_pl_dnbnord"/>
			<enumeration value="ch_pl_eskok"/>
			<enumeration value="ch_pl_pocztowy"/>
			<enumeration value="ch_pl_bgz"/>
			<enumeration value="ch_pl_eurobank"/>
			<enumeration value="ch_pl_fmbank"/>
			<enumeration value="ch_pl_mbank"/>
			<enumeration value="ch_pl_orange"/>
			<enumeration value="ch_pl_aliorbank"/>
			<enumeration value="ch_pl_ch"/>
			<enumeration value="ch_pl_idea"/>
			<enumeration value="ch_pl_iko"/>
			<enumeration value="ch_pl_inteligo"/>
			<enumeration value="ch_pl_pkobp"/>
			<enumeration value="ch_pl_plusbank"/>
			<enumeration value="ch_pl_ing"/>
			<enumeration value="ch_pl_polbank"/>
			<enumeration value="ch_pl_bps"/>
			<enumeration value="ch_pl_bph"/>
			<enumeration value="ch_pl_rb"/>
			<enumeration value="ch_pl_tmobile"/>
			<enumeration value="ch_pl_toyota"/>
			<enumeration value="ch_pl_volkswagen"/>
			<enumeration value="ch_cz_b"/>
			<enumeration value="ch_psd2"/>
			<enumeration value="ch_cz_sms_a"/>
			<enumeration value="ch_cz_sms_b"/>
			<enumeration value="ch_cz_sms_c"/>
			<enumeration value="ch_cz_pr_sms_a_r"/>
			<enumeration value="ch_cz_pr_sms_b_r"/>
			<enumeration value="ch_cz_pr_sms_c_r"/>
			<enumeration value="ch_cz_pr_sms_d_r"/>
			<enumeration value="ch_cz_pr_sms_a_n"/>
			<enumeration value="ch_cz_pr_sms_b_n"/>
			<enumeration value="ch_cz_pr_sms_c_n"/>
			<enumeration value="ch_cz_pr_sms_d_n"/>
			<enumeration value="ch_cz_mp_o2_r"/>
			<enumeration value="ch_cz_mp_vf_r"/>
			<enumeration value="ch_cz_mp_tm_r"/>
			<enumeration value="ch_cz_mp_o2_n"/>
			<enumeration value="ch_cz_mp_vf_n"/>
			<enumeration value="ch_cz_mp_tm_n"/>
			<enumeration value="ch_eu_psc"/>
			<enumeration value="ch_eu_paypal"/>
			<enumeration value="ch_eu_bitcoin"/>
			<enumeration value="ch_twisto_deferred_payment"/>
			<enumeration value="ch_twisto_pay_in_three"/>
			<enumeration value="ch_skippay_deferred_payment"/>
			<enumeration value="ch_skippay_pay_in_three"/>
		</restriction>
	</simpleType>

	<!-- =====================================================================
	     STORNO (refund platby)
	===================================================================== -->

	<complexType name="Storno">
		<annotation><documentation>Stornované platby (refund zákazníkovi). Generuje pár: storno (částka) + stornoFee (vrácení poplatku).</documentation></annotation>
		<sequence>
			<element name="movement" type="xs:StornoMovement" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>

	<complexType name="StornoMovement">
		<attribute name="accountMovementId" type="long" use="required">
			<annotation><documentation>ID zdrojového pohybu pro účetní párování.</documentation></annotation>
		</attribute>
		<attribute name="type" type="xs:StornoMovementType" use="required">
			<annotation><documentation>storno = vrácená částka platby; stornoFee = vrácení poplatku.</documentation></annotation>
		</attribute>
		<attribute name="amount" type="double" use="required">
			<annotation><documentation>Signed: storno i stornoFee jsou debity z pohledu sellera (záporné).</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum účtování pohybu (YYYY-MM-DD, ISO 8601).</documentation></annotation>
		</attribute>
		<attribute name="counterparty" type="string" use="optional">
			<annotation><documentation>Identifikace protistrany — typicky "GOPAY" nebo maskovaný PAN / IBAN.</documentation></annotation>
		</attribute>
		<attribute name="eshopGoId" type="long" use="required">
			<annotation><documentation>GoPay ID e-shopu, ke kterému stornovaná platba patřila.</documentation></annotation>
		</attribute>
		<attribute name="orderId" type="string" use="optional">
			<annotation><documentation>Variabilní symbol / order ID původní platby.</documentation></annotation>
		</attribute>
		<attribute name="paymentSessionId" type="long" use="optional">
			<annotation><documentation>GoPay ID původní platební session.</documentation></annotation>
		</attribute>
	</complexType>

	<simpleType name="StornoMovementType">
		<restriction base="string">
			<enumeration value="storno"/>
			<enumeration value="stornoFee"/>
		</restriction>
	</simpleType>

	<!-- =====================================================================
	     CREDIT NOTE (dobropis)
	===================================================================== -->

	<complexType name="CreditNote">
		<annotation><documentation>Dobropisy (vratky poplatků za zprostředkování plateb). Volitelný blok — generován pouze pokud byl ve clearingovém období vystaven dobropis.</documentation></annotation>
		<sequence>
			<element name="movement" type="xs:CreditNoteMovement" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>

	<complexType name="CreditNoteMovement">
		<attribute name="accountMovementId" type="long" use="required">
			<annotation><documentation>ID zdrojového pohybu.</documentation></annotation>
		</attribute>
		<attribute name="type" type="xs:CreditNoteMovementType" use="required">
			<annotation><documentation>Jediná hodnota <code>creditNote</code> — discriminator pro sjednocený <code>&lt;movement&gt;</code> element.</documentation></annotation>
		</attribute>
		<attribute name="amount" type="double" use="required">
			<annotation><documentation>Signed: vrácený poplatek se obvykle účtuje jako credit pro sellera (kladné).</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum účtování pohybu (YYYY-MM-DD, ISO 8601).</documentation></annotation>
		</attribute>
		<attribute name="counterparty" type="string" use="optional">
			<annotation><documentation>Typicky "GOPAY".</documentation></annotation>
		</attribute>
		<attribute name="clearingId" type="long" use="required">
			<annotation><documentation>ID původního clearingu, ke kterému se dobropis vztahuje.</documentation></annotation>
		</attribute>
	</complexType>

	<simpleType name="CreditNoteMovementType">
		<restriction base="string">
			<enumeration value="creditNote"/>
		</restriction>
	</simpleType>

	<!-- =====================================================================
	     SELLER DEPOSIT (navýšení zůstatku obchodního účtu z bankovních převodů sellera)
	===================================================================== -->

	<complexType name="SellerDeposit">
		<annotation><documentation>Navýšení zůstatku obchodního účtu z bankovních převodů sellera (na svůj GoPay účet).</documentation></annotation>
		<sequence>
			<element name="movement" type="xs:SellerDepositMovement" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>

	<complexType name="SellerDepositMovement">
		<attribute name="accountMovementId" type="long" use="required">
			<annotation><documentation>ID zdrojového pohybu pro účetní párování.</documentation></annotation>
		</attribute>
		<attribute name="type" type="xs:SellerDepositMovementType" use="required">
			<annotation><documentation>Typ pohybu. Aktuálně jediná hodnota: sellerDeposit (běžné navýšení zůstatku).</documentation></annotation>
		</attribute>
		<attribute name="amount" type="double" use="required">
			<annotation><documentation>Signed: vždy kladné (credit pro sellera).</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum účtování pohybu (YYYY-MM-DD, ISO 8601).</documentation></annotation>
		</attribute>
		<attribute name="note" type="string" use="optional">
			<annotation><documentation>Poznámka k transakci (např. zpráva z bankovního převodu).</documentation></annotation>
		</attribute>
	</complexType>

	<simpleType name="SellerDepositMovementType">
		<restriction base="string">
			<enumeration value="sellerDeposit"/>
		</restriction>
	</simpleType>

	<!-- =====================================================================
	     ADMINISTRATION FEE (správní poplatky: MIN_FEE, GATE_FEE, ONETIME_FEE)
	===================================================================== -->

	<complexType name="AdministrationFee">
		<annotation><documentation>Správní poplatky strhávané sellerovi — MIN_FEE (minimální poplatek), GATE_FEE (poplatek za gate), ONETIME_FEE (jednorázový poplatek).</documentation></annotation>
		<sequence>
			<element name="movement" type="xs:AdministrationFeeMovement" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>

	<complexType name="AdministrationFeeMovement">
		<attribute name="accountMovementId" type="long" use="required">
			<annotation><documentation>ID zdrojového pohybu pro účetní párování.</documentation></annotation>
		</attribute>
		<attribute name="type" type="xs:AdministrationFeeMovementType" use="required">
			<annotation><documentation>administrationFee = poplatek strženy; administrationFeeReversal = poplatek vrácen.</documentation></annotation>
		</attribute>
		<attribute name="debtType" type="xs:AccountDebtType" use="required">
			<annotation><documentation>Konkrétní typ správního poplatku (MIN_FEE / GATE_FEE / ONETIME_FEE).</documentation></annotation>
		</attribute>
		<attribute name="period" type="xs:PeriodYYYYMM" use="required">
			<annotation><documentation>Měsíc, ZA který je poplatek účtován (YYYYMM, např. "202604"). Liší se od datePerformed (datum reálného strhnutí).</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum reálného strhnutí poplatku ze sellerova účtu (YYYY-MM-DD (ISO 8601)).</documentation></annotation>
		</attribute>
		<attribute name="counterparty" type="string" use="optional">
			<annotation><documentation>Typicky "GOPAY".</documentation></annotation>
		</attribute>
		<attribute name="amount" type="double" use="required">
			<annotation><documentation>Signed: administrationFee = záporné, administrationFeeReversal = kladné.</documentation></annotation>
		</attribute>
	</complexType>

	<simpleType name="AdministrationFeeMovementType">
		<restriction base="string">
			<enumeration value="administrationFee"/>
			<enumeration value="administrationFeeReversal"/>
		</restriction>
	</simpleType>

	<simpleType name="AccountDebtType">
		<annotation><documentation>Druh správního poplatku.</documentation></annotation>
		<restriction base="string">
			<enumeration value="MIN_FEE"/>
			<enumeration value="GATE_FEE"/>
			<enumeration value="ONETIME_FEE"/>
		</restriction>
	</simpleType>

	<!-- =====================================================================
	     COMPENSATION BONUS (kompenzační bonus, např. KB věrnostní bonus)
	===================================================================== -->

	<complexType name="CompensationBonus">
		<annotation><documentation>Kompenzační bonus připsaný sellerovi (např. KB věrnostní program). Reversal = vrácení bonusu.</documentation></annotation>
		<sequence>
			<element name="movement" type="xs:CompensationBonusMovement" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>

	<complexType name="CompensationBonusMovement">
		<attribute name="accountMovementId" type="long" use="required">
			<annotation><documentation>ID zdrojového pohybu pro účetní párování.</documentation></annotation>
		</attribute>
		<attribute name="type" type="xs:CompensationBonusMovementType" use="required">
			<annotation><documentation>compensationBonus = přiznání bonusu; compensationBonusReversal = vrácení bonusu.</documentation></annotation>
		</attribute>
		<attribute name="period" type="xs:PeriodYYYYMM" use="optional">
			<annotation><documentation>Měsíc, za který je bonus připisován (YYYYMM). Volitelné — nemusí být dostupné pro všechny bonusy.</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum účtování pohybu (YYYY-MM-DD, ISO 8601).</documentation></annotation>
		</attribute>
		<attribute name="counterparty" type="string" use="optional">
			<annotation><documentation>Typicky "GOPAY".</documentation></annotation>
		</attribute>
		<attribute name="amount" type="double" use="required">
			<annotation><documentation>Signed: compensationBonus = kladné, compensationBonusReversal = záporné.</documentation></annotation>
		</attribute>
	</complexType>

	<simpleType name="CompensationBonusMovementType">
		<restriction base="string">
			<enumeration value="compensationBonus"/>
			<enumeration value="compensationBonusReversal"/>
		</restriction>
	</simpleType>

	<!-- =====================================================================
	     LEMONERO (splátky úvěru / financování obchodníka)
	===================================================================== -->

	<complexType name="Lemonero">
		<annotation><documentation>Splátky úvěru Lemonero (financování pro obchodníky). Reversal = storno splátky.</documentation></annotation>
		<sequence>
			<element name="movement" type="xs:LemoneroMovement" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>

	<complexType name="LemoneroMovement">
		<attribute name="accountMovementId" type="long" use="required">
			<annotation><documentation>ID zdrojového pohybu pro účetní párování.</documentation></annotation>
		</attribute>
		<attribute name="type" type="xs:LemoneroMovementType" use="required">
			<annotation><documentation>lemonero = splátka úvěru; lemoneroReversal = storno splátky.</documentation></annotation>
		</attribute>
		<attribute name="lemoneroLoanId" type="string" use="optional">
			<annotation><documentation>Externí ID úvěrové smlouvy. Volitelné — nemusí být dostupné.</documentation></annotation>
		</attribute>
		<attribute name="lemoneroTranId" type="string" use="optional">
			<annotation><documentation>Identifikátor konkrétní splátky (installment reference). Může být prázdný.</documentation></annotation>
		</attribute>
		<attribute name="period" type="xs:PeriodYYYYMM" use="optional">
			<annotation><documentation>Měsíc, za který je splátka účtována (YYYYMM).</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum účtování pohybu (YYYY-MM-DD, ISO 8601).</documentation></annotation>
		</attribute>
		<attribute name="counterparty" type="string" use="optional">
			<annotation><documentation>Typicky "GOPAY".</documentation></annotation>
		</attribute>
		<attribute name="amount" type="double" use="required">
			<annotation><documentation>Signed: lemonero = záporné (splátka odchází), lemoneroReversal = kladné.</documentation></annotation>
		</attribute>
	</complexType>

	<simpleType name="LemoneroMovementType">
		<restriction base="string">
			<enumeration value="lemonero"/>
			<enumeration value="lemoneroReversal"/>
		</restriction>
	</simpleType>

	<!-- =====================================================================
	     ACCOUNT UPDATE (poplatek za aktualizaci platební karty)
	===================================================================== -->

	<complexType name="AccountUpdate">
		<annotation><documentation>Poplatky za aktualizaci údajů platební karty (Account Updater služby kartových schém).</documentation></annotation>
		<sequence>
			<element name="movement" type="xs:AccountUpdateMovement" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>

	<complexType name="AccountUpdateMovement">
		<attribute name="accountMovementId" type="long" use="required">
			<annotation><documentation>ID zdrojového pohybu pro účetní párování.</documentation></annotation>
		</attribute>
		<attribute name="type" type="xs:AccountUpdateMovementType" use="required">
			<annotation><documentation>Diskriminátor pro sjednocený <code>&lt;movement&gt;</code> element. Jediná hodnota <code>accountUpdateFee</code>.</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum účtování pohybu (YYYY-MM-DD, ISO 8601).</documentation></annotation>
		</attribute>
		<attribute name="counterparty" type="string" use="optional">
			<annotation><documentation>Maskovaný PAN karty (např. "517008******5344"), které se aktualizace týkala.</documentation></annotation>
		</attribute>
		<attribute name="relatedId" type="string" use="optional">
			<annotation><documentation>ID související business entity v GoPay systému (např. paymentSessionId pro recurring platbu). Kontext určuje atribut relatedType. Vyplněno společně s relatedType.</documentation></annotation>
		</attribute>
		<attribute name="relatedType" type="xs:AccountUpdateRelatedType" use="optional">
			<annotation><documentation>Typ entity, na kterou ukazuje relatedId. Vyplněno společně s relatedId.</documentation></annotation>
		</attribute>
		<attribute name="amount" type="double" use="required">
			<annotation><documentation>Signed: vždy záporné (debit, poplatek se strhává).</documentation></annotation>
		</attribute>
	</complexType>

	<simpleType name="AccountUpdateMovementType">
		<restriction base="string">
			<enumeration value="accountUpdateFee"/>
		</restriction>
	</simpleType>

	<simpleType name="AccountUpdateRelatedType">
		<annotation><documentation>Typ business entity, ke které se aktualizace karty vztahuje. Určuje sémantiku atributu relatedId.</documentation></annotation>
		<restriction base="string">
			<enumeration value="paymentSession">
				<annotation><documentation>relatedId = paymentSessionId. Identifikuje recurring platební session, jejíž uložený card token byl aktualizován.</documentation></annotation>
			</enumeration>
			<enumeration value="eshopPaymentCard">
				<annotation><documentation>relatedId = MCOF token (Merchant Card On File) v eshop card vault.</documentation></annotation>
			</enumeration>
		</restriction>
	</simpleType>

	<!-- =====================================================================
	     EMV FEE (poplatek za platbu bez 3DS overení / EMV Frictionless)
	===================================================================== -->

	<complexType name="EmvFee">
		<annotation><documentation>Poplatky za karetní platby zpracované bez 3DS overení (frictionless flow).</documentation></annotation>
		<sequence>
			<element name="movement" type="xs:EmvFeeMovement" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>

	<complexType name="EmvFeeMovement">
		<annotation><documentation>EMV fee se agreguje denně, ne měsíčně — granularita je per datePerformed.</documentation></annotation>
		<attribute name="accountMovementId" type="long" use="required">
			<annotation><documentation>ID zdrojového pohybu pro účetní párování.</documentation></annotation>
		</attribute>
		<attribute name="type" type="xs:EmvFeeMovementType" use="required">
			<annotation><documentation>Diskriminátor pro sjednocený <code>&lt;movement&gt;</code> element. Jediná hodnota <code>emvFee</code>.</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum účtování fee transakce (= den, kdy GoPay strhl).</documentation></annotation>
		</attribute>
		<attribute name="counterparty" type="string" use="optional">
			<annotation><documentation>Typicky "GOPAY".</documentation></annotation>
		</attribute>
		<attribute name="amount" type="double" use="required">
			<annotation><documentation>Signed: vždy záporné (debit).</documentation></annotation>
		</attribute>
	</complexType>

	<simpleType name="EmvFeeMovementType">
		<restriction base="string">
			<enumeration value="emvFee"/>
		</restriction>
	</simpleType>

	<!-- =====================================================================
	     HOLDON (UNZ — Účet nevypořádaných zůstatků)
	===================================================================== -->

	<complexType name="Holdon">
		<annotation><documentation>Pohyby mezi sellerovým účtem a UNZ (Účet nevypořádaných zůstatků). Debit = peníze odchází (blokace), credit = peníze přicházejí (vrácení blokace, nespárované platby).</documentation></annotation>
		<sequence>
			<element name="movement" type="xs:HoldonMovement" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>

	<complexType name="HoldonMovement">
		<attribute name="accountMovementId" type="long" use="required">
			<annotation><documentation>ID zdrojového pohybu pro účetní párování.</documentation></annotation>
		</attribute>
		<attribute name="type" type="xs:HoldonMovementType" use="required">
			<annotation><documentation>holdonDebit = peníze odchází ze sellerova účtu (blokace); holdonCredit = peníze přicházejí na sellerův účet (vrácení / nespárované).</documentation></annotation>
		</attribute>
		<attribute name="variableSymbol" type="string" use="optional">
			<annotation><documentation>Variabilní symbol související transakce.</documentation></annotation>
		</attribute>
		<attribute name="datePerformed" type="date" use="required">
			<annotation><documentation>Datum účtování pohybu (YYYY-MM-DD, ISO 8601).</documentation></annotation>
		</attribute>
		<attribute name="counterparty" type="string" use="optional">
			<annotation><documentation>Typicky "GOPAY".</documentation></annotation>
		</attribute>
		<attribute name="amount" type="double" use="required">
			<annotation><documentation>Signed: holdonDebit = záporné, holdonCredit = kladné. Perspective = sellerův účet.</documentation></annotation>
		</attribute>
	</complexType>

	<simpleType name="HoldonMovementType">
		<restriction base="string">
			<enumeration value="holdonDebit"/>
			<enumeration value="holdonCredit"/>
		</restriction>
	</simpleType>

	<!-- =====================================================================
	     SDÍLENÉ TYPY
	===================================================================== -->

	<simpleType name="PeriodYYYYMM">
		<annotation><documentation>Měsíční perioda ve formátu YYYYMM (např. "202604" = duben 2026).</documentation></annotation>
		<restriction base="string">
			<pattern value="[0-9]{6}"/>
		</restriction>
	</simpleType>

</schema>
