<?php
// Previously ubl_mapping.yml
return (object) [
    'FactEnt' =>
    (object) [
        'mapping' =>
        (object) [
            'TYPE_NEW' =>
            (object) [
                'xpath' => '.',
                'format' => 'DocType',
            ],
            'FACT_FOU' =>
            (object) [
                'xpath' => './cbc:ID',
            ],
            'DATE_FAFO' =>
            (object) [
                'xpath' => './cbc:IssueDate',
                'format' => 'Date',
            ],
            'DTAE_ECH' =>
            (object) [
                'xpath' => './cbc:DueDate',
                'format' => 'Date',
            ],
            'DATE_ENR' =>
            (object) [
                'calculated' => 'date_now',
            ],
            'DATE_PER' =>
            (object) [
                'calculated' => 'date_now',
            ],
            'FabNote' =>
            (object) [
                'xpath' => '.',
                'format' => 'Concat',
                'concatXpath' => './cbc:Note',
                'max' => 3000,
            ],
            'listFacAnt' =>
            (object) [
                'xpath' => '.',
                'format' => 'BillingRef',
            ],
            'IBANCPT' =>
            (object) [
                'xpath' => './cac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID',
                'format' => 'IBAN',
                'formatPart' => 'BBAN',
            ],
            'IBANPAYS' =>
            (object) [
                'xpath' => './cac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID',
                'format' => 'IBAN',
                'formatPart' => 'IBAN_PAYS',
            ],
            'IBANCLE' =>
            (object) [
                'xpath' => './cac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID',
                'format' => 'IBAN',
                'formatPart' => 'IBAN_CLE',
            ],
            'CODE_BANQ' =>
            (object) [
                'xpath' => './cac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID',
                'format' => 'IBAN',
                'formatPart' => 'CODE_BANQ',
            ],
            'CODE_GUIC' =>
            (object) [
                'xpath' => './cac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID',
                'format' => 'IBAN',
                'formatPart' => 'CODE_GUIC',
            ],
            'NUM_COMPT' =>
            (object) [
                'xpath' => './cac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID',
                'format' => 'IBAN',
                'formatPart' => 'NUM_COMPT',
            ],
            'CLE_RIB' =>
            (object) [
                'xpath' => './cac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID',
                'format' => 'IBAN',
                'formatPart' => 'CLE_RIB',
            ],
            'DOM_BANQ' =>
            (object) [
                'xpath' => './cac:PaymentMeans/cac:PayeeFinancialAccount/cbc:Name',
            ],
            'CODEBIC' =>
            (object) [
                'xpath' => './cac:PaymentMeans/cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cbc:ID',
            ],
            'CODE_FOUR' =>
            (object) [
                'xpath' => '.',
                'format' => 'Entity',
                'entity' => '\\Entity\\Model\\Fourniss',
                'matching' =>
                [
                    (object) [
                        'NO_TVA_IC' =>
                        (object) [
                            'xpath' => './cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID',
                        ],
                    ],
                    (object) [
                        'CODE_PAYS' => 'FR',
                        'NO_SIRET' =>
                        (object) [
                            'xpath' => './cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification/cbc:ID[@schemeID=0009]',
                        ],
                    ],
                    (object) [
                        'CODE_PAYS' => 'FR',
                        'SIREN' =>
                        (object) [
                            'xpath' => './cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification/cbc:ID[@schemeID=0002]',
                        ],
                    ],
                ],
            ],
            'CODE_STE' =>
            (object) [
                'xpath' => '.',
                'format' => 'Entity',
                'entity' => '\\Entity\\Model\\Societe',
                'matching' =>
                [
                    (object) [
                        'FAC_DEMAT_ADRELEC' => (object) [
                            'xpath' => './cac:AccountingCustomerParty/cac:Party/cbc:EndpointID'
                        ],
                    ],
                    (object) [
                        'SIRET' => (object) [
                            'xpath' => './cac:AccountingCustomerParty/cac:Party/cac:PartyIdentification/cbc:ID[@schemeID=0009]',
                        ],
                    ],
                    (object) [
                        'NUM_TVAIC' => (object) [
                            'xpath' => './cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID',
                        ],
                    ],
                ],
            ],
            'DEVISE' =>
            (object) [
                'xpath' => '.',
                'format' => 'Entity',
                'entity' => '\\Entity\\Model\\Devise',
                'matching' =>
                [
                    0 =>
                    (object) [
                        'CODE_DEVI' =>
                        (object) [
                            'xpath' => './cbc:DocumentCurrencyCode',
                        ],
                    ],
                ],
            ],
            'MODE_REG' =>
            (object) [
                'xpath' => '.',
                'format' => 'Entity',
                'entity' => '\\Entity\\Model\\Modepaie',
                'matching' =>
                [
                    0 =>
                    (object) [
                        'CODE_UBL' =>
                        (object) [
                            'xpath' => './cac:PaymentMeans/cbc:PaymentMeansCode',
                        ],
                    ],
                ],
            ],
            'CdeLad' =>
            (object) [
                'xpath' => './cac:OrderReference/cbc:ID',
                'format' => 'CdeLad',
            ],
            'TOTAL_HT' =>
            (object) [
                'xpath' => './cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount',
                'format' => 'Amount',
            ],
            'TOTAL_TTC' =>
            (object) [
                'xpath' => './cac:LegalMonetaryTotal/cbc:PayableAmount',
                'format' => 'Amount',
            ],
            'FouRs' =>
            (object) [
                'xpath' => './cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName',
            ],
            'SocRs' =>
            (object) [
                'xpath' => './cac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName',
            ],
            'TotalTva' =>
            (object) [
                'xpath' => './cac:TaxTotal/cbc:TaxAmount',
            ],
            'SocEndpointScheme' =>
            (object) [
                'xpath' => './cac:AccountingCustomerParty/cac:Party/cbc:EndpointID/@schemeID',
            ],
            'SocEndpoint' =>
            (object) [
                'xpath' => './cac:AccountingCustomerParty/cac:Party/cbc:EndpointID',
            ],
            'FouEndpointScheme' =>
            (object) [
                'xpath' => './cac:AccountingSupplierParty/cac:Party/cbc:EndpointID/@schemeID',
            ],
            'FouEndpoint' =>
            (object) [
                'xpath' => './cac:AccountingSupplierParty/cac:Party/cbc:EndpointID',
            ],
            'InvoiceTypeCode' =>
            (object) [
                'xpath' => './cbc:InvoiceTypeCode',
            ],
            'PrepaidAmount' =>
            (object) [
                'xpath' => './cac:LegalMonetaryTotal/cbc:PrepaidAmount',
            ],
        ],
    ],
    'FactLig' =>
    (object) [
        'xpath' => './cac:InvoiceLine',
        'mapping' =>
        (object) [
            'NUM_LIG' =>
            (object) [
                'xpath' => './cbc:ID',
            ],
            'DESIGNAT' =>
            (object) [
                'xpath' => './cac:Item/cbc:Description',
            ],
            'QUANTITE' =>
            (object) [
                'xpath' => './cac:Price/cbc:BaseQuantity',
            ],
            'PU' =>
            (object) [
                'xpath' => './cac:Price/cbc:PriceAmount',
            ],
            'TAUX_TVA' =>
            (object) [
                'xpath' => './cac:Item/cac:ClassifiedTaxCategory/cbc:Percent',
            ],
        ],
    ],
];
