"""visaacceptancemergedspec.

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

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


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

    Attributes:
        key (str): The number you assign for as the key for your merchant-defined
            data field. Valid values are 0 to 100.  For example, to set or access the
            key for the 2nd merchant-defined data field in the array, you would
            reference `merchantDefinedInformation[1].key`.  #### Visa Acceptance
            through VisaNet For installment payments with Mastercard in Brazil, use
            `merchantDefinedInformation[0].key` and
            `merchantDefinedInformation[1].key` for data that you want to provide to
            the issuer to identify the transaction.
        value (str): The value you assign for your merchant-defined data field.
            **Warning** Merchant-defined data fields are not intended to and must not
            be used to capture personally identifying information. Accordingly,
            merchants are prohibited from capturing, obtaining, and/or transmitting
            any personally identifying information in or via the merchant-defined
            data fields. Personally identifying information includes, but is not
            limited to, address, credit card number, social security number, driver's
            license number, state-issued identification number, passport number, and
            card verification numbers (CVV, CVC2, CVV2, CID, CVN). In the event Visa
            Acceptance discovers that a merchant is capturing and/or transmitting
            personally identifying information via the merchant-defined data fields,
            whether or not intentionally, Visa Acceptance will immediately suspend
            the merchant's account, which will result in a rejection of any and all
            transaction requests submitted by the merchant after the point of
            suspension.  #### Visa Acceptance through VisaNet For installment
            payments with Mastercard in Brazil, use
            `merchantDefinedInformation[0].value` and
            `merchantDefinedInformation[1].value` for data that you want to provide
            to the issuer to identify the transaction.   For installment payments
            with Mastercard in Brazil: - The value for
            merchantDefinedInformation[0].value corresponds to the following data in
            the TC 33 capture file5:   - Record: CP07 TCR5   - Position: 25-44   -
            Field: Reference Field 2 - The value for
            merchantDefinedInformation[1].value corresponds to the following data in
            the TC 33 capture file5:   - Record: CP07 TCR5   - Position: 45-64   -
            Field: Reference Field 3
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

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

    _optionals = [
        "key",
        "value",
    ]

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

        # 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
        key =\
            dictionary.get("key")\
            if dictionary.get("key")\
                else APIHelper.SKIP
        value =\
            dictionary.get("value")\
            if dictionary.get("value")\
                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(key,
                   value,
                   additional_properties)

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

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