"""visaacceptancemergedspec.

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

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


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

    Attributes:
        tags (str): EMV data that is transmitted from the chip card to the issuer,
            and from the issuer to the chip card. The EMV data is in the
            tag-length-value format and includes chip card tags, terminal tags, and
            transaction detail tags.  For information about the individual tags, see
            the “Application Specification” section in the EMV 4.3 Specifications:
            **Note** Card present information about EMV applies only to credit card
            processing and PIN debit processing. All other card present information
            applies only to credit card processing. PIN debit processing is available
            only on FDC Nashville Global.  **Important** The following tags contain
            sensitive information and **must not** be included in this field:   -
            `56`: Track 1 equivalent data  - `57`: Track 2 equivalent data  - `5A`:
            Application PAN  - `5F20`: Cardholder name  - `5F24`: Application
            expiration date (This sensitivity has been relaxed for Credit Mutuel-CIC,
            American Express Direct, FDC Nashville Global, First Data Merchant
            Solutions, and SIX)  - `99`: Transaction PIN  - `9F0B`: Cardholder name
            (extended)  - `9F1F`: Track 1 discretionary data  - `9F20`: Track 2
            discretionary data  For captures, this field is required for contact EMV
            transactions. Otherwise, it is optional.  For credits, this field is
            required for contact EMV stand-alone credits and contactless EMV
            stand-alone credits. Otherwise, it is optional.  **Important** For
            contact EMV captures, contact EMV stand-alone credits, and contactless
            EMV stand-alone credits, you must include the following tags in this
            field. For all other types of EMV transactions, the following tags are
            optional.   - `95`: Terminal verification results  - `9F10`: Issuer
            application data  - `9F26`: Application cryptogram   #### Visa Acceptance
            through VisaNet - In Japan: 199 bytes - In other countries: String (252)
            For Mastercard Transactions, Optionally Tag 9F60 (Authenticated
            Application Data) and  Tag 96 (Kernel Identifier - Terminal) can be
            included in the Field.  #### GPX This field only supports transactions
            from the following card types: - Visa - Mastercard - AMEX - Discover -
            Diners - JCB - Union Pay International  #### JCN Gateway The following
            tags must be included: - `4F`: Application identifier - `84`: Dedicated
            file name  Data length: 199 bytes  #### All other processors: String
            (999)  #### Used by Authorization: Optional Authorization Reversal:
            Optional Credit: Optional PIN Debit processing (purchase, credit and
            reversal): Optional
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "tags": "tags",
    }

    _optionals = [
        "tags",
    ]

    def __init__(
        self,
        tags=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Emv2 instance."""
        # Initialize members of the class
        if tags is not APIHelper.SKIP:
            self.tags = tags

        # 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
        tags =\
            dictionary.get("tags")\
            if dictionary.get("tags")\
                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(tags,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _tags=(
            self.tags
            if hasattr(self, "tags")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"tags={_tags!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _tags=(
            self.tags
            if hasattr(self, "tags")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"tags={_tags!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
