"""visaacceptancemergedspec.

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

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


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

    Attributes:
        morphing (List[Morphing]): List of information codes triggered by the order.
            These information codes were generated when you created the order and
            product velocity rules and are returned so that you can associate them
            with the rules.  Returned by scoring service.
        address (List[str]): The model property of type List[str].
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

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

    _optionals = [
        "morphing",
        "address",
    ]

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

        # 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
        morphing = None
        if dictionary.get("morphing") is not None:
            morphing = [
                Morphing.from_dictionary(x)
                    for x in dictionary.get("morphing")
            ]
        else:
            morphing = APIHelper.SKIP
        address =\
            dictionary.get("address")\
            if dictionary.get("address")\
                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(morphing,
                   address,
                   additional_properties)

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

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