"""visaacceptancemergedspec.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)
from visaacceptancemergedspec.models.transaction_advice_addendum import (
    TransactionAdviceAddendum,
)


class InvoiceDetails(object):
    """Implementation of the 'InvoiceDetails' model.

    Attributes:
        invoice_number (str): Invoice Number.
        barcode_number (str): Barcode Number.
        expiration_date (str): Expiration Date.
        purchase_order_number (str): Value used by your customer to identify the
            order. This value is typically a purchase order number. Visa Acceptance
            recommends that you do not populate the field with all zeros or nines.
        purchase_order_date (str): Date the order was processed. `Format: YYYY-MM-DD`.
        purchase_contact_name (str): The name of the individual or the company
            contacted for company authorized purchases.
        taxable (bool): Flag that indicates whether an order is taxable. This value
            must be true if the sum of all _lineItems[].taxAmount_ values > 0.  If
            you do not include any `lineItems[].taxAmount` values in your request,
            Visa Acceptance does not include `invoiceDetails.taxable` in the data it
            sends to the processor.  Possible values:  - **true**  - **false**
        vat_invoice_reference_number (str): VAT invoice number associated with the
            transaction.
        commodity_code (str): International description code of the overall order’s
            goods or services or the Categorizes purchases for VAT reporting. Contact
            your acquirer for a list of codes.
        merchandise_code (int): Identifier for the merchandise. This field is
            supported only on the processors listed in this field description.  ####
            American Express Direct Possible value: - 1000: Gift card  #### Visa
            Acceptance through VisaNet This value must be right justified. In Japan,
            this value is called a _goods code_.  #### JCN Gateway This value must be
            right justified. In Japan, this value is called a _goods code_.
        transaction_advice_addendum (List[TransactionAdviceAddendum]): The model
            property of type List[TransactionAdviceAddendum].
        reference_data_code (str): Code that identifies the value of the
            `referenceDataNumber` field.  This field is a pass-through, which means
            that Visa Acceptance does not verify the value or modify it in any way
            before sending it to the processor.
        reference_data_number (str): Reference number. The meaning of this value is
            identified by the value of the `referenceDataCode` field.  This field is
            a pass-through, which means that Visa Acceptance does not verify the
            value or modify it in any way before sending it to the processor.
        sales_slip_number (int): Transaction identifier that is generated. You have
            the option of printing the sales slip number on the receipt. This field
            is supported only on Visa Acceptance through Visanet and JCN gateway.
            Optional field.  #### Card Present processing message If you included
            this field in the request, the returned value is the value that you sent
            in the request. If you did not include this field in the request, the
            system generated this value for you.  The difference between this reply
            field and the `processorInformation.systemTraceAuditNumber` field is that
            the system generates the system trace audit number (STAN), and you must
            print the receipt number on the receipt; whereas you can generate the
            sales slip number, and you can choose to print the sales slip number on
            the receipt.
        invoice_date (str): Date of the tax calculation. Use format YYYYMMDD. You can
            provide a date in the past if you are calculating tax for a refund and
            want to know what the tax was on the date the order was placed. You can
            provide a date in the future if you are calculating the tax for a future
            date, such as an upcoming tax holiday.  The default is the date, in
            Pacific time, that the bank receives the request. Keep this in mind if
            you are in a different time zone and want the tax calculated with the
            rates that are applicable on a specific date.  #### Tax Calculation
            Optional field for U.S., Canadian, international tax, and value added
            taxes.
        cost_center (str): Cost centre of the merchant
        issuer_message (str): Text message from the issuer. If you give the customer
            a receipt, display this value on the receipt.
        product_description (str): Brief description of item.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "invoice_number": "invoiceNumber",
        "barcode_number": "barcodeNumber",
        "expiration_date": "expirationDate",
        "purchase_order_number": "purchaseOrderNumber",
        "purchase_order_date": "purchaseOrderDate",
        "purchase_contact_name": "purchaseContactName",
        "taxable": "taxable",
        "vat_invoice_reference_number": "vatInvoiceReferenceNumber",
        "commodity_code": "commodityCode",
        "merchandise_code": "merchandiseCode",
        "transaction_advice_addendum": "transactionAdviceAddendum",
        "reference_data_code": "referenceDataCode",
        "reference_data_number": "referenceDataNumber",
        "sales_slip_number": "salesSlipNumber",
        "invoice_date": "invoiceDate",
        "cost_center": "costCenter",
        "issuer_message": "issuerMessage",
        "product_description": "productDescription",
    }

    _optionals = [
        "invoice_number",
        "barcode_number",
        "expiration_date",
        "purchase_order_number",
        "purchase_order_date",
        "purchase_contact_name",
        "taxable",
        "vat_invoice_reference_number",
        "commodity_code",
        "merchandise_code",
        "transaction_advice_addendum",
        "reference_data_code",
        "reference_data_number",
        "sales_slip_number",
        "invoice_date",
        "cost_center",
        "issuer_message",
        "product_description",
    ]

    def __init__(
        self,
        invoice_number=APIHelper.SKIP,
        barcode_number=APIHelper.SKIP,
        expiration_date=APIHelper.SKIP,
        purchase_order_number=APIHelper.SKIP,
        purchase_order_date=APIHelper.SKIP,
        purchase_contact_name=APIHelper.SKIP,
        taxable=APIHelper.SKIP,
        vat_invoice_reference_number=APIHelper.SKIP,
        commodity_code=APIHelper.SKIP,
        merchandise_code=APIHelper.SKIP,
        transaction_advice_addendum=APIHelper.SKIP,
        reference_data_code=APIHelper.SKIP,
        reference_data_number=APIHelper.SKIP,
        sales_slip_number=APIHelper.SKIP,
        invoice_date=APIHelper.SKIP,
        cost_center=APIHelper.SKIP,
        issuer_message=APIHelper.SKIP,
        product_description=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a InvoiceDetails instance."""
        # Initialize members of the class
        if invoice_number is not APIHelper.SKIP:
            self.invoice_number = invoice_number
        if barcode_number is not APIHelper.SKIP:
            self.barcode_number = barcode_number
        if expiration_date is not APIHelper.SKIP:
            self.expiration_date = expiration_date
        if purchase_order_number is not APIHelper.SKIP:
            self.purchase_order_number = purchase_order_number
        if purchase_order_date is not APIHelper.SKIP:
            self.purchase_order_date = purchase_order_date
        if purchase_contact_name is not APIHelper.SKIP:
            self.purchase_contact_name = purchase_contact_name
        if taxable is not APIHelper.SKIP:
            self.taxable = taxable
        if vat_invoice_reference_number is not APIHelper.SKIP:
            self.vat_invoice_reference_number = vat_invoice_reference_number
        if commodity_code is not APIHelper.SKIP:
            self.commodity_code = commodity_code
        if merchandise_code is not APIHelper.SKIP:
            self.merchandise_code = merchandise_code
        if transaction_advice_addendum is not APIHelper.SKIP:
            self.transaction_advice_addendum = transaction_advice_addendum
        if reference_data_code is not APIHelper.SKIP:
            self.reference_data_code = reference_data_code
        if reference_data_number is not APIHelper.SKIP:
            self.reference_data_number = reference_data_number
        if sales_slip_number is not APIHelper.SKIP:
            self.sales_slip_number = sales_slip_number
        if invoice_date is not APIHelper.SKIP:
            self.invoice_date = invoice_date
        if cost_center is not APIHelper.SKIP:
            self.cost_center = cost_center
        if issuer_message is not APIHelper.SKIP:
            self.issuer_message = issuer_message
        if product_description is not APIHelper.SKIP:
            self.product_description = product_description

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        invoice_number =\
            dictionary.get("invoiceNumber")\
            if dictionary.get("invoiceNumber")\
                else APIHelper.SKIP
        barcode_number =\
            dictionary.get("barcodeNumber")\
            if dictionary.get("barcodeNumber")\
                else APIHelper.SKIP
        expiration_date =\
            dictionary.get("expirationDate")\
            if dictionary.get("expirationDate")\
                else APIHelper.SKIP
        purchase_order_number =\
            dictionary.get("purchaseOrderNumber")\
            if dictionary.get("purchaseOrderNumber")\
                else APIHelper.SKIP
        purchase_order_date =\
            dictionary.get("purchaseOrderDate")\
            if dictionary.get("purchaseOrderDate")\
                else APIHelper.SKIP
        purchase_contact_name =\
            dictionary.get("purchaseContactName")\
            if dictionary.get("purchaseContactName")\
                else APIHelper.SKIP
        taxable =\
            dictionary.get("taxable")\
            if "taxable" in dictionary.keys()\
                else APIHelper.SKIP
        vat_invoice_reference_number =\
            dictionary.get("vatInvoiceReferenceNumber")\
            if dictionary.get("vatInvoiceReferenceNumber")\
                else APIHelper.SKIP
        commodity_code =\
            dictionary.get("commodityCode")\
            if dictionary.get("commodityCode")\
                else APIHelper.SKIP
        merchandise_code =\
            dictionary.get("merchandiseCode")\
            if dictionary.get("merchandiseCode")\
                else APIHelper.SKIP
        transaction_advice_addendum = None
        if dictionary.get("transactionAdviceAddendum") is not None:
            transaction_advice_addendum = [
                TransactionAdviceAddendum.from_dictionary(x)
                    for x in dictionary.get("transactionAdviceAddendum")
            ]
        else:
            transaction_advice_addendum = APIHelper.SKIP
        reference_data_code =\
            dictionary.get("referenceDataCode")\
            if dictionary.get("referenceDataCode")\
                else APIHelper.SKIP
        reference_data_number =\
            dictionary.get("referenceDataNumber")\
            if dictionary.get("referenceDataNumber")\
                else APIHelper.SKIP
        sales_slip_number =\
            dictionary.get("salesSlipNumber")\
            if dictionary.get("salesSlipNumber")\
                else APIHelper.SKIP
        invoice_date =\
            dictionary.get("invoiceDate")\
            if dictionary.get("invoiceDate")\
                else APIHelper.SKIP
        cost_center =\
            dictionary.get("costCenter")\
            if dictionary.get("costCenter")\
                else APIHelper.SKIP
        issuer_message =\
            dictionary.get("issuerMessage")\
            if dictionary.get("issuerMessage")\
                else APIHelper.SKIP
        product_description =\
            dictionary.get("productDescription")\
            if dictionary.get("productDescription")\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(invoice_number,
                   barcode_number,
                   expiration_date,
                   purchase_order_number,
                   purchase_order_date,
                   purchase_contact_name,
                   taxable,
                   vat_invoice_reference_number,
                   commodity_code,
                   merchandise_code,
                   transaction_advice_addendum,
                   reference_data_code,
                   reference_data_number,
                   sales_slip_number,
                   invoice_date,
                   cost_center,
                   issuer_message,
                   product_description,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _invoice_number=(
            self.invoice_number
            if hasattr(self, "invoice_number")
            else None
        )
        _barcode_number=(
            self.barcode_number
            if hasattr(self, "barcode_number")
            else None
        )
        _expiration_date=(
            self.expiration_date
            if hasattr(self, "expiration_date")
            else None
        )
        _purchase_order_number=(
            self.purchase_order_number
            if hasattr(self, "purchase_order_number")
            else None
        )
        _purchase_order_date=(
            self.purchase_order_date
            if hasattr(self, "purchase_order_date")
            else None
        )
        _purchase_contact_name=(
            self.purchase_contact_name
            if hasattr(self, "purchase_contact_name")
            else None
        )
        _taxable=(
            self.taxable
            if hasattr(self, "taxable")
            else None
        )
        _vat_invoice_reference_number=(
            self.vat_invoice_reference_number
            if hasattr(self, "vat_invoice_reference_number")
            else None
        )
        _commodity_code=(
            self.commodity_code
            if hasattr(self, "commodity_code")
            else None
        )
        _merchandise_code=(
            self.merchandise_code
            if hasattr(self, "merchandise_code")
            else None
        )
        _transaction_advice_addendum=(
            self.transaction_advice_addendum
            if hasattr(self, "transaction_advice_addendum")
            else None
        )
        _reference_data_code=(
            self.reference_data_code
            if hasattr(self, "reference_data_code")
            else None
        )
        _reference_data_number=(
            self.reference_data_number
            if hasattr(self, "reference_data_number")
            else None
        )
        _sales_slip_number=(
            self.sales_slip_number
            if hasattr(self, "sales_slip_number")
            else None
        )
        _invoice_date=(
            self.invoice_date
            if hasattr(self, "invoice_date")
            else None
        )
        _cost_center=(
            self.cost_center
            if hasattr(self, "cost_center")
            else None
        )
        _issuer_message=(
            self.issuer_message
            if hasattr(self, "issuer_message")
            else None
        )
        _product_description=(
            self.product_description
            if hasattr(self, "product_description")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"invoice_number={_invoice_number!r}, "
            f"barcode_number={_barcode_number!r}, "
            f"expiration_date={_expiration_date!r}, "
            f"purchase_order_number={_purchase_order_number!r}, "
            f"purchase_order_date={_purchase_order_date!r}, "
            f"purchase_contact_name={_purchase_contact_name!r}, "
            f"taxable={_taxable!r}, "
            f"vat_invoice_reference_number={_vat_invoice_reference_number!r}, "
            f"commodity_code={_commodity_code!r}, "
            f"merchandise_code={_merchandise_code!r}, "
            f"transaction_advice_addendum={_transaction_advice_addendum!r}, "
            f"reference_data_code={_reference_data_code!r}, "
            f"reference_data_number={_reference_data_number!r}, "
            f"sales_slip_number={_sales_slip_number!r}, "
            f"invoice_date={_invoice_date!r}, "
            f"cost_center={_cost_center!r}, "
            f"issuer_message={_issuer_message!r}, "
            f"product_description={_product_description!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _invoice_number=(
            self.invoice_number
            if hasattr(self, "invoice_number")
            else None
        )
        _barcode_number=(
            self.barcode_number
            if hasattr(self, "barcode_number")
            else None
        )
        _expiration_date=(
            self.expiration_date
            if hasattr(self, "expiration_date")
            else None
        )
        _purchase_order_number=(
            self.purchase_order_number
            if hasattr(self, "purchase_order_number")
            else None
        )
        _purchase_order_date=(
            self.purchase_order_date
            if hasattr(self, "purchase_order_date")
            else None
        )
        _purchase_contact_name=(
            self.purchase_contact_name
            if hasattr(self, "purchase_contact_name")
            else None
        )
        _taxable=(
            self.taxable
            if hasattr(self, "taxable")
            else None
        )
        _vat_invoice_reference_number=(
            self.vat_invoice_reference_number
            if hasattr(self, "vat_invoice_reference_number")
            else None
        )
        _commodity_code=(
            self.commodity_code
            if hasattr(self, "commodity_code")
            else None
        )
        _merchandise_code=(
            self.merchandise_code
            if hasattr(self, "merchandise_code")
            else None
        )
        _transaction_advice_addendum=(
            self.transaction_advice_addendum
            if hasattr(self, "transaction_advice_addendum")
            else None
        )
        _reference_data_code=(
            self.reference_data_code
            if hasattr(self, "reference_data_code")
            else None
        )
        _reference_data_number=(
            self.reference_data_number
            if hasattr(self, "reference_data_number")
            else None
        )
        _sales_slip_number=(
            self.sales_slip_number
            if hasattr(self, "sales_slip_number")
            else None
        )
        _invoice_date=(
            self.invoice_date
            if hasattr(self, "invoice_date")
            else None
        )
        _cost_center=(
            self.cost_center
            if hasattr(self, "cost_center")
            else None
        )
        _issuer_message=(
            self.issuer_message
            if hasattr(self, "issuer_message")
            else None
        )
        _product_description=(
            self.product_description
            if hasattr(self, "product_description")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"invoice_number={_invoice_number!s}, "
            f"barcode_number={_barcode_number!s}, "
            f"expiration_date={_expiration_date!s}, "
            f"purchase_order_number={_purchase_order_number!s}, "
            f"purchase_order_date={_purchase_order_date!s}, "
            f"purchase_contact_name={_purchase_contact_name!s}, "
            f"taxable={_taxable!s}, "
            f"vat_invoice_reference_number={_vat_invoice_reference_number!s}, "
            f"commodity_code={_commodity_code!s}, "
            f"merchandise_code={_merchandise_code!s}, "
            f"transaction_advice_addendum={_transaction_advice_addendum!s}, "
            f"reference_data_code={_reference_data_code!s}, "
            f"reference_data_number={_reference_data_number!s}, "
            f"sales_slip_number={_sales_slip_number!s}, "
            f"invoice_date={_invoice_date!s}, "
            f"cost_center={_cost_center!s}, "
            f"issuer_message={_issuer_message!s}, "
            f"product_description={_product_description!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
