"""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.emv_1 import (
    Emv1,
)


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

    Attributes:
        emv (Emv1): The model property of type Emv1.
        amex_capn_data (str): Point-of-sale details for the transaction. This value
            is returned only for **American Express Direct**. Visa Acceptance
            generates this value, which consists of a series of codes that identify
            terminal capability, security data, and specific conditions present at
            the time the transaction occurred. To comply with the CAPN requirements,
            this value must be included in all subsequent follow-on requests, such as
            captures and follow-on credits.  When you perform authorizations,
            captures, and credits through Visa Acceptance, Visa Acceptance passes
            this value from the authorization service to the subsequent services for
            you. However, when you perform authorizations through Visa Acceptance and
            perform subsequent services through other financial institutions, you
            must ensure that your requests for captures and credits include this
            value.
        terminal_id (str): Identifier for the terminal at your retail location. You
            can define this value yourself, but consult the processor for
            requirements.  #### Visa Acceptance through VisaNet A list of all
            possible values is stored in your Visa Acceptance account. If terminal ID
            validation is enabled for your Visa Acceptance account, the value you
            send for this field is validated against the list each time you include
            the field in a request. To enable or disable terminal ID validation,
            contact Visa Acceptance Customer Support.  When you do not include this
            field in a request, Visa Acceptance uses the default value that is
            defined in your Visa Acceptance account.  #### FDC Nashville Global To
            have your account configured to support this field, contact Visa
            Acceptance Customer Support. This value must be a value that FDC
            Nashville Global issued to you.  #### For Payouts This field is
            applicable for Visa Acceptance through VisaNet.  #### GPX Identifier for
            the terminal at your retail location. A list of all possible values is
            stored in your account. If terminal ID validation is enabled for your
            account, the value you send for this field is validated against the list
            each time you include the field in a request. To enable or disable
            terminal ID validation, contact customer support.  When you do not
            include this field in a request, the default value that is defined in
            your account is used.  Optional for authorizations.  #### Used by
            **Authorization** Optional for the following processors. When you do not
            include this field in a request, the default value that is defined in
            your account is used.   - American Express Direct   - Credit Mutuel-CIC
            - FDC Nashville Global   - SIX - Chase Paymentech Solutions: Optional
            field. If you include this field in your request, you must also include
            `pointOfSaleInformation.catLevel`. - FDMS Nashville: The default value
            that is defined in your account is used. - GPX - OmniPay Direct: Optional
            field.  For the following processors, this field is not used. - GPN - JCN
            Gateway - RBS WorldPay Atlanta - TSYS Acquiring Solutions - Worldpay VAP
            #### Card Present reply Terminal identifier assigned by the acquirer.
            This value must be printed on the receipt.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "emv": "emv",
        "amex_capn_data": "amexCapnData",
        "terminal_id": "terminalId",
    }

    _optionals = [
        "emv",
        "amex_capn_data",
        "terminal_id",
    ]

    def __init__(
        self,
        emv=APIHelper.SKIP,
        amex_capn_data=APIHelper.SKIP,
        terminal_id=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PointOfSaleInformation1 instance."""
        # Initialize members of the class
        if emv is not APIHelper.SKIP:
            self.emv = emv
        if amex_capn_data is not APIHelper.SKIP:
            self.amex_capn_data = amex_capn_data
        if terminal_id is not APIHelper.SKIP:
            self.terminal_id = terminal_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
        emv =\
            Emv1.from_dictionary(
                dictionary.get("emv"))\
                if "emv" in dictionary.keys()\
                else APIHelper.SKIP
        amex_capn_data =\
            dictionary.get("amexCapnData")\
            if dictionary.get("amexCapnData")\
                else APIHelper.SKIP
        terminal_id =\
            dictionary.get("terminalId")\
            if dictionary.get("terminalId")\
                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(emv,
                   amex_capn_data,
                   terminal_id,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _emv=(
            self.emv
            if hasattr(self, "emv")
            else None
        )
        _amex_capn_data=(
            self.amex_capn_data
            if hasattr(self, "amex_capn_data")
            else None
        )
        _terminal_id=(
            self.terminal_id
            if hasattr(self, "terminal_id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"emv={_emv!r}, "
            f"amex_capn_data={_amex_capn_data!r}, "
            f"terminal_id={_terminal_id!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _emv=(
            self.emv
            if hasattr(self, "emv")
            else None
        )
        _amex_capn_data=(
            self.amex_capn_data
            if hasattr(self, "amex_capn_data")
            else None
        )
        _terminal_id=(
            self.terminal_id
            if hasattr(self, "terminal_id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"emv={_emv!s}, "
            f"amex_capn_data={_amex_capn_data!s}, "
            f"terminal_id={_terminal_id!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
