"""visaacceptancemergedspec.

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

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


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

    Attributes:
        count (int): Morphing count specified by the number #.  **Note** The count is
            not returned for the initial transaction.
        field_name (str): Field name of the morphing element. specified by the
            setting that you chose in the Velocity Editor.  For all possible values,
            see the `decisionReply_morphingElement_#_fieldName` field description in
            the _Decision Manager Using the SCMP API Developer Guide_ on the [Visa
            Acceptance Business Center.]( Click **Decision Manager** >
            **Documentation** > **Guides** > _Decision Manager Using the SCMP API
            Developer Guide_ (PDF link).
        information_code (str): Identifier that Visa Acceptance assigned to the
            velocity rule specified by the number #.  For all possible values, see
            the `decision_velocity_morphing_#_info_code` field description in the
            _Decision Manager Using the SCMP API Developer Guide_ on the [Visa
            Acceptance Business Center.]( Click **Decision Manager** >
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "count": "count",
        "field_name": "fieldName",
        "information_code": "informationCode",
    }

    _optionals = [
        "count",
        "field_name",
        "information_code",
    ]

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

        # 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
        count =\
            dictionary.get("count")\
            if dictionary.get("count")\
                else APIHelper.SKIP
        field_name =\
            dictionary.get("fieldName")\
            if dictionary.get("fieldName")\
                else APIHelper.SKIP
        information_code =\
            dictionary.get("informationCode")\
            if dictionary.get("informationCode")\
                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(count,
                   field_name,
                   information_code,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _count=(
            self.count
            if hasattr(self, "count")
            else None
        )
        _field_name=(
            self.field_name
            if hasattr(self, "field_name")
            else None
        )
        _information_code=(
            self.information_code
            if hasattr(self, "information_code")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"count={_count!r}, "
            f"field_name={_field_name!r}, "
            f"information_code={_information_code!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _count=(
            self.count
            if hasattr(self, "count")
            else None
        )
        _field_name=(
            self.field_name
            if hasattr(self, "field_name")
            else None
        )
        _information_code=(
            self.information_code
            if hasattr(self, "information_code")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"count={_count!s}, "
            f"field_name={_field_name!s}, "
            f"information_code={_information_code!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
