"""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.auxiliary_datum import (
    AuxiliaryDatum,
)
from visaacceptancemergedspec.models.buyer_history import (
    BuyerHistory,
)
from visaacceptancemergedspec.models.profile_3 import (
    Profile3,
)


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

    Attributes:
        profile (Profile3): The model property of type Profile3.
        event_type (str): Specifies one of the following types of events: - login -
            account_creation - account_update For regular payment transactions, do
            not send this field.
        buyer_history (BuyerHistory): The model property of type BuyerHistory.
        auxiliary_data (List[AuxiliaryDatum]): The model property of type
            List[AuxiliaryDatum].
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "profile": "profile",
        "event_type": "eventType",
        "buyer_history": "buyerHistory",
        "auxiliary_data": "auxiliaryData",
    }

    _optionals = [
        "profile",
        "event_type",
        "buyer_history",
        "auxiliary_data",
    ]

    def __init__(
        self,
        profile=APIHelper.SKIP,
        event_type=APIHelper.SKIP,
        buyer_history=APIHelper.SKIP,
        auxiliary_data=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a RiskInformation3 instance."""
        # Initialize members of the class
        if profile is not APIHelper.SKIP:
            self.profile = profile
        if event_type is not APIHelper.SKIP:
            self.event_type = event_type
        if buyer_history is not APIHelper.SKIP:
            self.buyer_history = buyer_history
        if auxiliary_data is not APIHelper.SKIP:
            self.auxiliary_data = auxiliary_data

        # 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
        profile =\
            Profile3.from_dictionary(
                dictionary.get("profile"))\
                if "profile" in dictionary.keys()\
                else APIHelper.SKIP
        event_type =\
            dictionary.get("eventType")\
            if dictionary.get("eventType")\
                else APIHelper.SKIP
        buyer_history =\
            BuyerHistory.from_dictionary(
                dictionary.get("buyerHistory"))\
                if "buyerHistory" in dictionary.keys()\
                else APIHelper.SKIP
        auxiliary_data = None
        if dictionary.get("auxiliaryData") is not None:
            auxiliary_data = [
                AuxiliaryDatum.from_dictionary(x)
                    for x in dictionary.get("auxiliaryData")
            ]
        else:
            auxiliary_data = 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(profile,
                   event_type,
                   buyer_history,
                   auxiliary_data,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _profile=(
            self.profile
            if hasattr(self, "profile")
            else None
        )
        _event_type=(
            self.event_type
            if hasattr(self, "event_type")
            else None
        )
        _buyer_history=(
            self.buyer_history
            if hasattr(self, "buyer_history")
            else None
        )
        _auxiliary_data=(
            self.auxiliary_data
            if hasattr(self, "auxiliary_data")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"profile={_profile!r}, "
            f"event_type={_event_type!r}, "
            f"buyer_history={_buyer_history!r}, "
            f"auxiliary_data={_auxiliary_data!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _profile=(
            self.profile
            if hasattr(self, "profile")
            else None
        )
        _event_type=(
            self.event_type
            if hasattr(self, "event_type")
            else None
        )
        _buyer_history=(
            self.buyer_history
            if hasattr(self, "buyer_history")
            else None
        )
        _auxiliary_data=(
            self.auxiliary_data
            if hasattr(self, "auxiliary_data")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"profile={_profile!s}, "
            f"event_type={_event_type!s}, "
            f"buyer_history={_buyer_history!s}, "
            f"auxiliary_data={_auxiliary_data!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
