"""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.merchant_descriptor import (
    MerchantDescriptor,
)


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

    Attributes:
        merchant_descriptor (MerchantDescriptor): The model property of type
            MerchantDescriptor.
        category_code (int): The value for this field is a four-digit number that the
            payment card industry uses to classify merchants into market segments. A
            payment card company assigned one or more of these values to your
            business when you started accepting the payment card company’s cards.
            When you do not include this field in your request, Visa Acceptance uses
            the value in your Visa Acceptance account.  #### Visa Acceptance through
            VisaNet The value for this field corresponds to the following data in the
            TC 33 capture file5: - Record: CP01 TCR4 - Position: 150-153 - Field:
            Merchant Category Code
        vat_registration_number (str): Your government-assigned tax identification
            number.  #### Tax Calculation Required field for value added tax only.
            Not applicable to U.S. and Canadian taxes.  #### Visa Acceptance through
            VisaNet For CtV processors, the maximum length is 20.
        card_acceptor_reference_number (str): Reference number that facilitates card
            acceptor/corporation communication and record keeping.
        tax_id (str): Your Cadastro Nacional da Pessoa Jurídica (CNPJ) number.  This
            field is supported only for BNDES transactions on Visa Acceptance through
            VisaNet.  The value for this field corresponds to the following data in
            the TC 33 capture file5: - Record: CP07 TCR6 - Position: 40-59 - Field:
            BNDES Reference Field 1
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "merchant_descriptor": "merchantDescriptor",
        "category_code": "categoryCode",
        "vat_registration_number": "vatRegistrationNumber",
        "card_acceptor_reference_number": "cardAcceptorReferenceNumber",
        "tax_id": "taxId",
    }

    _optionals = [
        "merchant_descriptor",
        "category_code",
        "vat_registration_number",
        "card_acceptor_reference_number",
        "tax_id",
    ]

    def __init__(
        self,
        merchant_descriptor=APIHelper.SKIP,
        category_code=APIHelper.SKIP,
        vat_registration_number=APIHelper.SKIP,
        card_acceptor_reference_number=APIHelper.SKIP,
        tax_id=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a MerchantInformation4 instance."""
        # Initialize members of the class
        if merchant_descriptor is not APIHelper.SKIP:
            self.merchant_descriptor = merchant_descriptor
        if category_code is not APIHelper.SKIP:
            self.category_code = category_code
        if vat_registration_number is not APIHelper.SKIP:
            self.vat_registration_number = vat_registration_number
        if card_acceptor_reference_number is not APIHelper.SKIP:
            self.card_acceptor_reference_number = card_acceptor_reference_number
        if tax_id is not APIHelper.SKIP:
            self.tax_id = tax_id

        # 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
        merchant_descriptor =\
            MerchantDescriptor.from_dictionary(
                dictionary.get("merchantDescriptor"))\
                if "merchantDescriptor" in dictionary.keys()\
                else APIHelper.SKIP
        category_code =\
            dictionary.get("categoryCode")\
            if dictionary.get("categoryCode")\
                else APIHelper.SKIP
        vat_registration_number =\
            dictionary.get("vatRegistrationNumber")\
            if dictionary.get("vatRegistrationNumber")\
                else APIHelper.SKIP
        card_acceptor_reference_number =\
            dictionary.get("cardAcceptorReferenceNumber")\
            if dictionary.get("cardAcceptorReferenceNumber")\
                else APIHelper.SKIP
        tax_id =\
            dictionary.get("taxId")\
            if dictionary.get("taxId")\
                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(merchant_descriptor,
                   category_code,
                   vat_registration_number,
                   card_acceptor_reference_number,
                   tax_id,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _merchant_descriptor=(
            self.merchant_descriptor
            if hasattr(self, "merchant_descriptor")
            else None
        )
        _category_code=(
            self.category_code
            if hasattr(self, "category_code")
            else None
        )
        _vat_registration_number=(
            self.vat_registration_number
            if hasattr(self, "vat_registration_number")
            else None
        )
        _card_acceptor_reference_number=(
            self.card_acceptor_reference_number
            if hasattr(self, "card_acceptor_reference_number")
            else None
        )
        _tax_id=(
            self.tax_id
            if hasattr(self, "tax_id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_descriptor={_merchant_descriptor!r}, "
            f"category_code={_category_code!r}, "
            f"vat_registration_number={_vat_registration_number!r}, "
            f"card_acceptor_reference_number={_card_acceptor_reference_number!r}, "
            f"tax_id={_tax_id!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _merchant_descriptor=(
            self.merchant_descriptor
            if hasattr(self, "merchant_descriptor")
            else None
        )
        _category_code=(
            self.category_code
            if hasattr(self, "category_code")
            else None
        )
        _vat_registration_number=(
            self.vat_registration_number
            if hasattr(self, "vat_registration_number")
            else None
        )
        _card_acceptor_reference_number=(
            self.card_acceptor_reference_number
            if hasattr(self, "card_acceptor_reference_number")
            else None
        )
        _tax_id=(
            self.tax_id
            if hasattr(self, "tax_id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_descriptor={_merchant_descriptor!s}, "
            f"category_code={_category_code!s}, "
            f"vat_registration_number={_vat_registration_number!s}, "
            f"card_acceptor_reference_number={_card_acceptor_reference_number!s}, "
            f"tax_id={_tax_id!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
