"""visaacceptancemergedspec.

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

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


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

    Attributes:
        country (str): Country in which the card was issued. This information enables
            you to determine whether the card was issued domestically or
            internationally. Use the two-character [ISO Standard Country Codes](
            This field is supported for Visa, Mastercard, Discover, Diners Club, JCB,
            and Maestro (International) on Chase Paymentech Solutions.
        discretionary_data (str): Data defined by the issuer.  The value for this
            reply field will probably be the same as the value that you submitted in
            the authorization request, but it is possible for the processor, issuer,
            or acquirer to modify the value.  This field is supported only for Visa
            transactions on **Visa Acceptance through VisaNet**.
        country_specific_discretionary_data (str): Data defined by the issuer.  This
            national use field contains two subfields for information unique to the
            processing of Visa transactions by members in Japan. This subfield
            contains the Katakana text to be printed on the receipt.
        response_code (str): This is the raw Association/Issuer Response Codes. You
            can use ‘issuer/association’ response codes to identify when you can
            retry to authorize a declined transaction and increase successful
            transaction volumes. You’ll receive an association/issuer response code
            for the majority of transactions.  #### Processors supported:   - HSBC
            - FDC Nashville Global   - SIX  Currently SIX is not receiving
            Association/Issuer Response Codes here it receives the additional
            authorization code that must be printed on the receipt when returned by
            the processor.  #### Possible values: | Card Type   | Response Code |
            Description
            | | ----------- | ------------- |
            --------------------------------------------------------------------------
            ---- | | VISA        | 000           | Successful approval/completion or
            that V.I.P. PIN verification is successful   | | VISA        | 001
            | Refer to card issuer
            | | VISA        | 002           | Refer to card issuer, special condition
            | | VISA        | 003           | Invalid merchant or service provider
            | | VISA        | 004           | Pickup card
            |   | MasterCard  | 000           | Approved or completed successfully
            | | MasterCard  | 001           | Refer to card issuer
            | | MasterCard  | 003           | Invalid merchant
            | | MasterCard  | 004           | Capture card
            | | MasterCard  | 005           | Do not honor
            | | AMEX        | 000           | Approved
            | | AMEX        | 001           | Approve with ID
            | | AMEX        | 002           | Partial Approval (Prepaid Cards only)
            | | AMEX        | 100           | Deny
            | | AMEX        | 101           | Expired Card/Invalid Expiration Date
            | | Discover    | 000           | Approved or completed successfully
            | | Discover    | 001           | Reserved for future USE
            | | Discover    | 002           | Reserved for future USE
            | | Discover    | 003           | Invalid Merchant
            | | Discover    | 004           | Capture Card
            |
        pin_request_indicator (str): This field contains value ‘1’ which is sent by
            Issuer in the response when PIN is requested by issuer,   This field is
            only supported for Visa Platform Connect.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "country": "country",
        "discretionary_data": "discretionaryData",
        "country_specific_discretionary_data": "countrySpecificDiscretionaryData",
        "response_code": "responseCode",
        "pin_request_indicator": "pinRequestIndicator",
    }

    _optionals = [
        "country",
        "discretionary_data",
        "country_specific_discretionary_data",
        "response_code",
        "pin_request_indicator",
    ]

    def __init__(
        self,
        country=APIHelper.SKIP,
        discretionary_data=APIHelper.SKIP,
        country_specific_discretionary_data=APIHelper.SKIP,
        response_code=APIHelper.SKIP,
        pin_request_indicator=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a IssuerInformation2 instance."""
        # Initialize members of the class
        if country is not APIHelper.SKIP:
            self.country = country
        if discretionary_data is not APIHelper.SKIP:
            self.discretionary_data = discretionary_data
        if country_specific_discretionary_data is not APIHelper.SKIP:
            self.country_specific_discretionary_data =\
                 country_specific_discretionary_data
        if response_code is not APIHelper.SKIP:
            self.response_code = response_code
        if pin_request_indicator is not APIHelper.SKIP:
            self.pin_request_indicator = pin_request_indicator

        # 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
        country =\
            dictionary.get("country")\
            if dictionary.get("country")\
                else APIHelper.SKIP
        discretionary_data =\
            dictionary.get("discretionaryData")\
            if dictionary.get("discretionaryData")\
                else APIHelper.SKIP
        country_specific_discretionary_data =\
            dictionary.get("countrySpecificDiscretionaryData")\
            if dictionary.get("countrySpecificDiscretionaryData")\
                else APIHelper.SKIP
        response_code =\
            dictionary.get("responseCode")\
            if dictionary.get("responseCode")\
                else APIHelper.SKIP
        pin_request_indicator =\
            dictionary.get("pinRequestIndicator")\
            if dictionary.get("pinRequestIndicator")\
                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(country,
                   discretionary_data,
                   country_specific_discretionary_data,
                   response_code,
                   pin_request_indicator,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _country=(
            self.country
            if hasattr(self, "country")
            else None
        )
        _discretionary_data=(
            self.discretionary_data
            if hasattr(self, "discretionary_data")
            else None
        )
        _country_specific_discretionary_data=(
            self.country_specific_discretionary_data
            if hasattr(self, "country_specific_discretionary_data")
            else None
        )
        _response_code=(
            self.response_code
            if hasattr(self, "response_code")
            else None
        )
        _pin_request_indicator=(
            self.pin_request_indicator
            if hasattr(self, "pin_request_indicator")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"country={_country!r}, "
            f"discretionary_data={_discretionary_data!r}, "
            f"country_specific_discretionary_data={_country_specific_discretionary_data!r}, "
            f"response_code={_response_code!r}, "
            f"pin_request_indicator={_pin_request_indicator!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _country=(
            self.country
            if hasattr(self, "country")
            else None
        )
        _discretionary_data=(
            self.discretionary_data
            if hasattr(self, "discretionary_data")
            else None
        )
        _country_specific_discretionary_data=(
            self.country_specific_discretionary_data
            if hasattr(self, "country_specific_discretionary_data")
            else None
        )
        _response_code=(
            self.response_code
            if hasattr(self, "response_code")
            else None
        )
        _pin_request_indicator=(
            self.pin_request_indicator
            if hasattr(self, "pin_request_indicator")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"country={_country!s}, "
            f"discretionary_data={_discretionary_data!s}, "
            f"country_specific_discretionary_data={_country_specific_discretionary_data!s}, "
            f"response_code={_response_code!s}, "
            f"pin_request_indicator={_pin_request_indicator!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
