# coding: utf-8

"""
    FactPulse REST API

     REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures.  ## 🎯 Main Features  ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search)  ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF)  ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage)  ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing  ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations  ## 🔒 Authentication  All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ```  ### How to obtain a JWT token?  #### 🔑 Method 1: `/api/token/` API (Recommended)  **URL:** `https://factpulse.fr/api/token/`  This method is **recommended** for integration in your applications and CI/CD workflows.  **Prerequisites:** Having set a password on your account  **For users registered via email/password:** - You already have a password, use it directly  **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API  **Request example:** ```bash curl -X POST https://factpulse.fr/api/token/ \\   -H \"Content-Type: application/json\" \\   -d '{     \"username\": \"your_email@example.com\",     \"password\": \"your_password\"   }' ```  **Optional `client_uid` parameter:**  To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`:  ```bash curl -X POST https://factpulse.fr/api/token/ \\   -H \"Content-Type: application/json\" \\   -d '{     \"username\": \"your_email@example.com\",     \"password\": \"your_password\",     \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\"   }' ```  The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client  **Response:** ```json {   \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\",  // Access token (validity: 30 min)   \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\"  // Refresh token (validity: 7 days) } ```  **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool  #### 🖥️ Method 2: Dashboard Generation (Alternative)  **URL:** https://factpulse.fr/api/dashboard/  This method is suitable for quick tests or occasional use via the graphical interface.  **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password  **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan  **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface  **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation  ### 📚 Full Documentation  For more information on authentication and API usage: https://factpulse.fr/documentation-api/     

    The version of the OpenAPI document: 1.0.0
    Contact: contact@factpulse.fr
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


import unittest

from factpulse.models.factur_x_invoice import FacturXInvoice

class TestFacturXInvoice(unittest.TestCase):
    """FacturXInvoice unit test stubs"""

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def make_instance(self, include_optional) -> FacturXInvoice:
        """Test FacturXInvoice
            include_optional is a boolean, when False only required
            params are included, when True both required and
            optional params are included """
        # uncomment below to create an instance of `FacturXInvoice`
        """
        model = FacturXInvoice()
        if include_optional:
            return FacturXInvoice(
                invoice_number = '',
                payment_due_date = '',
                invoice_date = '',
                submission_mode = 'SAISIE_API',
                recipient = factpulse.models.recipient.Recipient(
                    electronic_address = null, 
                    executing_service_code = '', 
                    name = '', 
                    siren = '', 
                    siret = '', 
                    vat_number = '', 
                    postal_address = null, 
                    contact = null, 
                    global_ids = [
                        factpulse.models.electronic_address.ElectronicAddress(
                            identifier = '', 
                            scheme_id = null, )
                        ], ),
                supplier = factpulse.models.supplier.Supplier(
                    electronic_address = null, 
                    supplier_id = 56, 
                    private_id = '', 
                    supplier_bank_account_code = 56, 
                    supplier_service_id = 56, 
                    name = '', 
                    trading_business_name = '', 
                    legal_description = '', 
                    siren = '', 
                    siret = '', 
                    vat_number = '', 
                    iban = '', 
                    bic = '', 
                    bank_account_name = '', 
                    proprietary_id = '', 
                    postal_address = null, 
                    contact = null, 
                    global_ids = [
                        factpulse.models.electronic_address.ElectronicAddress(
                            identifier = '', 
                            scheme_id = null, )
                        ], ),
                invoicing_framework = factpulse.models.invoicing_framework.InvoicingFramework(
                    invoicing_framework_code = null, 
                    operation_nature = null, 
                    approver_service_code = '', 
                    approver_structure_code = '', ),
                references = factpulse.models.invoice_references.InvoiceReferences(
                    business_process_id = '', 
                    invoice_currency = 'EUR', 
                    payment_means = null, 
                    payment_means_text = '', 
                    invoice_type = '380', 
                    vat_accounting_code = null, 
                    buyer_reference = '', 
                    contract_reference = '', 
                    purchase_order_reference = '', 
                    seller_order_reference = '', 
                    receiving_advice_reference = '', 
                    despatch_advice_reference = '', 
                    tender_reference = '', 
                    preceding_invoice_reference = '', 
                    preceding_invoice_date = '', 
                    project_reference = '', 
                    project_name = '', 
                    vat_exemption_reason = '', ),
                totals = factpulse.models.invoice_totals.InvoiceTotals(
                    line_total_amount = null, 
                    allowance_total_amount = null, 
                    charge_total_amount = null, 
                    total_net_amount = null, 
                    vat_amount = null, 
                    total_gross_amount = null, 
                    prepayment = null, 
                    rounding_amount = null, 
                    amount_due = null, 
                    global_allowance_amount = null, 
                    global_allowance_reason = '', ),
                invoice_lines = [
                    factpulse.models.invoice_line.InvoiceLine(
                        line_number = 56, 
                        line_note = '', 
                        parent_line_id = '', 
                        line_sub_type = null, 
                        reference = '', 
                        buyer_assigned_id = '', 
                        product_global_id = '', 
                        product_global_id_scheme = '', 
                        item_name = '', 
                        item_description = '', 
                        origin_country = '', 
                        characteristics = [
                            factpulse.models.product_characteristic.ProductCharacteristic(
                                name = '', 
                                value = '', )
                            ], 
                        classifications = [
                            factpulse.models.product_classification.ProductClassification(
                                class_code = '', 
                                list_id = '', 
                                list_version_id = '', )
                            ], 
                        quantity = null, 
                        unit = null, 
                        gross_unit_price = null, 
                        unit_net_price = null, 
                        price_basis_quantity = null, 
                        price_basis_unit = '', 
                        price_allowance_amount = null, 
                        line_net_amount = null, 
                        allowance_amount = null, 
                        allowance_reason_code = null, 
                        allowance_reason = '', 
                        allowances_charges = [
                            factpulse.models.allowance_charge.AllowanceCharge(
                                is_charge = True, 
                                amount = null, 
                                base_amount = null, 
                                percentage = null, 
                                reason = '', 
                                reason_code = null, 
                                vat_category = null, 
                                vat_rate = null, )
                            ], 
                        vat_rate = '', 
                        manual_vat_rate = null, 
                        vat_category = null, 
                        period_start_date = '', 
                        period_end_date = '', 
                        purchase_order_line_ref = '', 
                        accounting_account = '', 
                        additional_documents = [
                            factpulse.models.additional_document.AdditionalDocument(
                                id = '', 
                                type_code = '', 
                                name = '', 
                                uri = '', 
                                reference_type_code = '', )
                            ], 
                        line_notes = [
                            factpulse.models.invoice_note.InvoiceNote(
                                subject_code = '', 
                                content = '', )
                            ], )
                    ],
                vat_lines = [
                    factpulse.models.vat_line.VATLine(
                        taxable_amount = null, 
                        vat_amount = null, 
                        rate = '', 
                        manual_rate = null, 
                        category = null, 
                        due_date_type_code = null, 
                        exemption_reason = '', 
                        vatex_code = '', )
                    ],
                notes = [
                    factpulse.models.invoice_note.InvoiceNote(
                        subject_code = '', 
                        content = '', )
                    ],
                comment = '',
                current_user_id = 56,
                supplementary_attachments = [
                    factpulse.models.supplementary_attachment.SupplementaryAttachment(
                        description = '', 
                        id = 56, 
                        link_id = 56, 
                        invoice_line_number = 56, 
                        type = '', )
                    ],
                payee = factpulse.models.payee.Payee(
                    nom = '0', 
                    payee_id = '', 
                    siret = '04807288800152', 
                    siren = '048072888', 
                    electronic_address = null, 
                    iban = '', 
                    bic = '', 
                    global_ids = [
                        factpulse.models.electronic_address.ElectronicAddress(
                            identifier = '', 
                            scheme_id = null, )
                        ], ),
                delivery_party = factpulse.models.delivery_party.DeliveryParty(
                    id = '', 
                    global_id = null, 
                    name = '', 
                    postal_address = null, ),
                tax_representative = factpulse.models.tax_representative.TaxRepresentative(
                    name = '', 
                    vat_number = '', 
                    postal_address = null, ),
                delivery_date = '',
                billing_period_start = '',
                billing_period_end = '',
                payment_reference = '',
                creditor_reference_id = '',
                direct_debit_mandate_id = '',
                debtor_iban = '',
                payment_terms = '',
                allowances_charges = [
                    factpulse.models.allowance_charge.AllowanceCharge(
                        is_charge = True, 
                        amount = null, 
                        base_amount = null, 
                        percentage = null, 
                        reason = '', 
                        reason_code = null, 
                        vat_category = null, 
                        vat_rate = null, )
                    ],
                additional_documents = [
                    factpulse.models.additional_document.AdditionalDocument(
                        id = '', 
                        type_code = '', 
                        name = '', 
                        uri = '', 
                        reference_type_code = '', )
                    ],
                buyer_accounting_reference = '',
                payment_card = factpulse.models.payment_card.PaymentCard(
                    card_id = '', 
                    cardholder_name = '', )
            )
        else:
            return FacturXInvoice(
                invoice_number = '',
                payment_due_date = '',
                submission_mode = 'SAISIE_API',
                recipient = factpulse.models.recipient.Recipient(
                    electronic_address = null, 
                    executing_service_code = '', 
                    name = '', 
                    siren = '', 
                    siret = '', 
                    vat_number = '', 
                    postal_address = null, 
                    contact = null, 
                    global_ids = [
                        factpulse.models.electronic_address.ElectronicAddress(
                            identifier = '', 
                            scheme_id = null, )
                        ], ),
                supplier = factpulse.models.supplier.Supplier(
                    electronic_address = null, 
                    supplier_id = 56, 
                    private_id = '', 
                    supplier_bank_account_code = 56, 
                    supplier_service_id = 56, 
                    name = '', 
                    trading_business_name = '', 
                    legal_description = '', 
                    siren = '', 
                    siret = '', 
                    vat_number = '', 
                    iban = '', 
                    bic = '', 
                    bank_account_name = '', 
                    proprietary_id = '', 
                    postal_address = null, 
                    contact = null, 
                    global_ids = [
                        factpulse.models.electronic_address.ElectronicAddress(
                            identifier = '', 
                            scheme_id = null, )
                        ], ),
                invoicing_framework = factpulse.models.invoicing_framework.InvoicingFramework(
                    invoicing_framework_code = null, 
                    operation_nature = null, 
                    approver_service_code = '', 
                    approver_structure_code = '', ),
                references = factpulse.models.invoice_references.InvoiceReferences(
                    business_process_id = '', 
                    invoice_currency = 'EUR', 
                    payment_means = null, 
                    payment_means_text = '', 
                    invoice_type = '380', 
                    vat_accounting_code = null, 
                    buyer_reference = '', 
                    contract_reference = '', 
                    purchase_order_reference = '', 
                    seller_order_reference = '', 
                    receiving_advice_reference = '', 
                    despatch_advice_reference = '', 
                    tender_reference = '', 
                    preceding_invoice_reference = '', 
                    preceding_invoice_date = '', 
                    project_reference = '', 
                    project_name = '', 
                    vat_exemption_reason = '', ),
                totals = factpulse.models.invoice_totals.InvoiceTotals(
                    line_total_amount = null, 
                    allowance_total_amount = null, 
                    charge_total_amount = null, 
                    total_net_amount = null, 
                    vat_amount = null, 
                    total_gross_amount = null, 
                    prepayment = null, 
                    rounding_amount = null, 
                    amount_due = null, 
                    global_allowance_amount = null, 
                    global_allowance_reason = '', ),
        )
        """

    def testFacturXInvoice(self):
        """Test FacturXInvoice"""
        # inst_req_only = self.make_instance(include_optional=False)
        # inst_req_and_optional = self.make_instance(include_optional=True)

if __name__ == '__main__':
    unittest.main()
