"""visaacceptancemergedspec.

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

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


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

    Attributes:
        category (str): Categorization of response message from processor  Possible
            Values: - `ISSUER_WILL_NEVER_APPROVE` -
            `ISSUER_CANNOT_APPROVE_AT_THIS_TIME` -
            `ISSUER_CANNOT_APPROVE_WITH_THESE_DETAILS` - `GENERIC_ERROR` -
            `PAYMENT_INSIGHTS_INTERNAL_ERROR` - `OTHERS` -
            `PAYMENT_INSIGHTS_RESPONSE_CATEGORY_MATCH_NOT_FOUND`
        category_code (str): Categorization Code of response message from processor
            Possible Values: - `01` : ISSUER_WILL_NEVER_APPROVE - `02` :
            ISSUER_CANNOT_APPROVE_AT_THIS_TIME - `03` :
            ISSUER_CANNOT_APPROVE_WITH_THESE_DETAILS - `04` : GENERIC_ERROR - `97` :
            PAYMENT_INSIGHTS_INTERNAL_ERROR - `98` : OTHERS - `99` :
            PAYMENT_INSIGHTS_RESPONSE_CATEGORY_MATCH_NOT_FOUND
        processor_raw_name (str): Raw name of the processor used for the transaction
            processing, especially useful during acquirer swing to see which
            processor transaction settled with
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "category": "category",
        "category_code": "categoryCode",
        "processor_raw_name": "processorRawName",
    }

    _optionals = [
        "category",
        "category_code",
        "processor_raw_name",
    ]

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

        # 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
        category =\
            dictionary.get("category")\
            if dictionary.get("category")\
                else APIHelper.SKIP
        category_code =\
            dictionary.get("categoryCode")\
            if dictionary.get("categoryCode")\
                else APIHelper.SKIP
        processor_raw_name =\
            dictionary.get("processorRawName")\
            if dictionary.get("processorRawName")\
                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(category,
                   category_code,
                   processor_raw_name,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _category=(
            self.category
            if hasattr(self, "category")
            else None
        )
        _category_code=(
            self.category_code
            if hasattr(self, "category_code")
            else None
        )
        _processor_raw_name=(
            self.processor_raw_name
            if hasattr(self, "processor_raw_name")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"category={_category!r}, "
            f"category_code={_category_code!r}, "
            f"processor_raw_name={_processor_raw_name!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _category=(
            self.category
            if hasattr(self, "category")
            else None
        )
        _category_code=(
            self.category_code
            if hasattr(self, "category_code")
            else None
        )
        _processor_raw_name=(
            self.processor_raw_name
            if hasattr(self, "processor_raw_name")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"category={_category!s}, "
            f"category_code={_category_code!s}, "
            f"processor_raw_name={_processor_raw_name!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
