"""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.info_codes import (
    InfoCodes,
)
from visaacceptancemergedspec.models.ip_address_2 import (
    IpAddress2,
)
from visaacceptancemergedspec.models.processor_results import (
    ProcessorResults,
)
from visaacceptancemergedspec.models.profile_1 import (
    Profile1,
)
from visaacceptancemergedspec.models.rule import (
    Rule,
)
from visaacceptancemergedspec.models.score import (
    Score,
)
from visaacceptancemergedspec.models.travel import (
    Travel,
)
from visaacceptancemergedspec.models.velocity import (
    Velocity,
)


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

    Contains the result of risk assessment.

    Attributes:
        profile (Profile1): The model property of type Profile1.
        rules (List[Rule]): The model property of type List[Rule].
        info_codes (InfoCodes): The model property of type InfoCodes.
        velocity (Velocity): The model property of type Velocity.
        case_priority (int): You receive this field only if you subscribe to the
            Enhanced Case Management service. The priority level ranges from 1
            (highest) to 5 (lowest); the default value is 3. If you do not assign a
            priority to your rules or to your profiles, the default value is given to
            the order.  For all possible values, see the `decision_case_priority`
            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).
        local_time (str): The customer's local time (`hh:mm:ss`), which is calculated
            from the transaction request time and the customer's billing address.
            For details, see the `score_time_local` field description in the
            _Decision Manager Using the SCMP API Developer Guide_ on the [Visa
            Acceptance Business Center.](
        score (Score): The model property of type Score.
        ip_address (IpAddress2): The model property of type IpAddress2.
        providers (Dict[str, str]): Name of the 3rd party provider, for example,
            Emailage. For all possible values, see the `decision_provider_#_name`
            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).
        travel (Travel): The model property of type Travel.
        processor_results (ProcessorResults): The model property of type
            ProcessorResults.
        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",
        "rules": "rules",
        "info_codes": "infoCodes",
        "velocity": "velocity",
        "case_priority": "casePriority",
        "local_time": "localTime",
        "score": "score",
        "ip_address": "ipAddress",
        "providers": "providers",
        "travel": "travel",
        "processor_results": "processorResults",
    }

    _optionals = [
        "profile",
        "rules",
        "info_codes",
        "velocity",
        "case_priority",
        "local_time",
        "score",
        "ip_address",
        "providers",
        "travel",
        "processor_results",
    ]

    def __init__(
        self,
        profile=APIHelper.SKIP,
        rules=APIHelper.SKIP,
        info_codes=APIHelper.SKIP,
        velocity=APIHelper.SKIP,
        case_priority=APIHelper.SKIP,
        local_time=APIHelper.SKIP,
        score=APIHelper.SKIP,
        ip_address=APIHelper.SKIP,
        providers=APIHelper.SKIP,
        travel=APIHelper.SKIP,
        processor_results=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a RiskInformation1 instance."""
        # Initialize members of the class
        if profile is not APIHelper.SKIP:
            self.profile = profile
        if rules is not APIHelper.SKIP:
            self.rules = rules
        if info_codes is not APIHelper.SKIP:
            self.info_codes = info_codes
        if velocity is not APIHelper.SKIP:
            self.velocity = velocity
        if case_priority is not APIHelper.SKIP:
            self.case_priority = case_priority
        if local_time is not APIHelper.SKIP:
            self.local_time = local_time
        if score is not APIHelper.SKIP:
            self.score = score
        if ip_address is not APIHelper.SKIP:
            self.ip_address = ip_address
        if providers is not APIHelper.SKIP:
            self.providers = providers
        if travel is not APIHelper.SKIP:
            self.travel = travel
        if processor_results is not APIHelper.SKIP:
            self.processor_results = processor_results

        # 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 =\
            Profile1.from_dictionary(
                dictionary.get("profile"))\
                if "profile" in dictionary.keys()\
                else APIHelper.SKIP
        rules = None
        if dictionary.get("rules") is not None:
            rules = [
                Rule.from_dictionary(x)
                    for x in dictionary.get("rules")
            ]
        else:
            rules = APIHelper.SKIP
        info_codes =\
            InfoCodes.from_dictionary(
                dictionary.get("infoCodes"))\
                if "infoCodes" in dictionary.keys()\
                else APIHelper.SKIP
        velocity =\
            Velocity.from_dictionary(
                dictionary.get("velocity"))\
                if "velocity" in dictionary.keys()\
                else APIHelper.SKIP
        case_priority =\
            dictionary.get("casePriority")\
            if dictionary.get("casePriority")\
                else APIHelper.SKIP
        local_time =\
            dictionary.get("localTime")\
            if dictionary.get("localTime")\
                else APIHelper.SKIP
        score =\
            Score.from_dictionary(
                dictionary.get("score"))\
                if "score" in dictionary.keys()\
                else APIHelper.SKIP
        ip_address =\
            IpAddress2.from_dictionary(
                dictionary.get("ipAddress"))\
                if "ipAddress" in dictionary.keys()\
                else APIHelper.SKIP
        providers =\
            dictionary.get("providers")\
            if dictionary.get("providers")\
                else APIHelper.SKIP
        travel =\
            Travel.from_dictionary(
                dictionary.get("travel"))\
                if "travel" in dictionary.keys()\
                else APIHelper.SKIP
        processor_results =\
            ProcessorResults.from_dictionary(
                dictionary.get("processorResults"))\
                if "processorResults" in dictionary.keys()\
                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(profile,
                   rules,
                   info_codes,
                   velocity,
                   case_priority,
                   local_time,
                   score,
                   ip_address,
                   providers,
                   travel,
                   processor_results,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _profile=(
            self.profile
            if hasattr(self, "profile")
            else None
        )
        _rules=(
            self.rules
            if hasattr(self, "rules")
            else None
        )
        _info_codes=(
            self.info_codes
            if hasattr(self, "info_codes")
            else None
        )
        _velocity=(
            self.velocity
            if hasattr(self, "velocity")
            else None
        )
        _case_priority=(
            self.case_priority
            if hasattr(self, "case_priority")
            else None
        )
        _local_time=(
            self.local_time
            if hasattr(self, "local_time")
            else None
        )
        _score=(
            self.score
            if hasattr(self, "score")
            else None
        )
        _ip_address=(
            self.ip_address
            if hasattr(self, "ip_address")
            else None
        )
        _providers=(
            self.providers
            if hasattr(self, "providers")
            else None
        )
        _travel=(
            self.travel
            if hasattr(self, "travel")
            else None
        )
        _processor_results=(
            self.processor_results
            if hasattr(self, "processor_results")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"profile={_profile!r}, "
            f"rules={_rules!r}, "
            f"info_codes={_info_codes!r}, "
            f"velocity={_velocity!r}, "
            f"case_priority={_case_priority!r}, "
            f"local_time={_local_time!r}, "
            f"score={_score!r}, "
            f"ip_address={_ip_address!r}, "
            f"providers={_providers!r}, "
            f"travel={_travel!r}, "
            f"processor_results={_processor_results!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
        )
        _rules=(
            self.rules
            if hasattr(self, "rules")
            else None
        )
        _info_codes=(
            self.info_codes
            if hasattr(self, "info_codes")
            else None
        )
        _velocity=(
            self.velocity
            if hasattr(self, "velocity")
            else None
        )
        _case_priority=(
            self.case_priority
            if hasattr(self, "case_priority")
            else None
        )
        _local_time=(
            self.local_time
            if hasattr(self, "local_time")
            else None
        )
        _score=(
            self.score
            if hasattr(self, "score")
            else None
        )
        _ip_address=(
            self.ip_address
            if hasattr(self, "ip_address")
            else None
        )
        _providers=(
            self.providers
            if hasattr(self, "providers")
            else None
        )
        _travel=(
            self.travel
            if hasattr(self, "travel")
            else None
        )
        _processor_results=(
            self.processor_results
            if hasattr(self, "processor_results")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"profile={_profile!s}, "
            f"rules={_rules!s}, "
            f"info_codes={_info_codes!s}, "
            f"velocity={_velocity!s}, "
            f"case_priority={_case_priority!s}, "
            f"local_time={_local_time!s}, "
            f"score={_score!s}, "
            f"ip_address={_ip_address!s}, "
            f"providers={_providers!s}, "
            f"travel={_travel!s}, "
            f"processor_results={_processor_results!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
