"""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_6 import (
    Emv6,
)


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

    Attributes:
        emv (Emv6): The model property of type Emv6.
        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.
        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",
    }

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

    def __init__(
        self,
        emv=APIHelper.SKIP,
        amex_capn_data=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PointOfSaleInformation6 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

        # 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 =\
            Emv6.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

        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,
                   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
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"emv={_emv!r}, "
            f"amex_capn_data={_amex_capn_data!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
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"emv={_emv!s}, "
            f"amex_capn_data={_amex_capn_data!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
