"""visaacceptancemergedspec.

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

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


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

    Contains detailed response information about the customer's IP address.

    Attributes:
        anonymizer_status (str): Indicates whether the transaction IP address is
            associated with a known anonymous proxy.  For all possible values, see
            the `score_ip_anonymizer_status` 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).
        locality (str): Name of the city decoded from the IP address used directly or
            indirectly by the customer to send the order.  For all possible values,
            see the `score_ip_city` 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).
        country (str): Name of the country decoded from the IP address used directly
            or indirectly by the customer to send the order.  For all possible
            values, see the `score_ip_country` 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).
        administrative_area (str): Name of the state decoded from the IP address used
            directly or indirectly by the customer to send the order.  For all
            possible values, see the `score_ip_state` 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).
        routing_method (str): Routing method decoded from the IP address used
            directly or indirectly by the customer to send the order.  For all
            possible values, see the `score_ip_routing_method` 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).
        carrier (str): Provides the name of the organization that owns the ASN. The
            carrier is responsible for the traffic carried on the network or set of
            networks designated as an Autonomous System (AS) and identified by the
            ASN. While there are more than 27,000 active ASNs, there are fewer
            carriers, because a single carrier often manages several ASNs.
        organization (str): The Registering Organization is the entity responsible
            for the actions and content associated with a given block of IP
            addresses. This is in contrast to the carrier, which is responsible for
            the routing of traffic for network blocks. Registering Organizations
            include many types of entities, including corporate, government, or
            educational entities, and ISPs managing the allocation and use of network
            blocks.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "anonymizer_status": "anonymizerStatus",
        "locality": "locality",
        "country": "country",
        "administrative_area": "administrativeArea",
        "routing_method": "routingMethod",
        "carrier": "carrier",
        "organization": "organization",
    }

    _optionals = [
        "anonymizer_status",
        "locality",
        "country",
        "administrative_area",
        "routing_method",
        "carrier",
        "organization",
    ]

    def __init__(
        self,
        anonymizer_status=APIHelper.SKIP,
        locality=APIHelper.SKIP,
        country=APIHelper.SKIP,
        administrative_area=APIHelper.SKIP,
        routing_method=APIHelper.SKIP,
        carrier=APIHelper.SKIP,
        organization=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a IpAddress instance."""
        # Initialize members of the class
        if anonymizer_status is not APIHelper.SKIP:
            self.anonymizer_status = anonymizer_status
        if locality is not APIHelper.SKIP:
            self.locality = locality
        if country is not APIHelper.SKIP:
            self.country = country
        if administrative_area is not APIHelper.SKIP:
            self.administrative_area = administrative_area
        if routing_method is not APIHelper.SKIP:
            self.routing_method = routing_method
        if carrier is not APIHelper.SKIP:
            self.carrier = carrier
        if organization is not APIHelper.SKIP:
            self.organization = organization

        # 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
        anonymizer_status =\
            dictionary.get("anonymizerStatus")\
            if dictionary.get("anonymizerStatus")\
                else APIHelper.SKIP
        locality =\
            dictionary.get("locality")\
            if dictionary.get("locality")\
                else APIHelper.SKIP
        country =\
            dictionary.get("country")\
            if dictionary.get("country")\
                else APIHelper.SKIP
        administrative_area =\
            dictionary.get("administrativeArea")\
            if dictionary.get("administrativeArea")\
                else APIHelper.SKIP
        routing_method =\
            dictionary.get("routingMethod")\
            if dictionary.get("routingMethod")\
                else APIHelper.SKIP
        carrier =\
            dictionary.get("carrier")\
            if dictionary.get("carrier")\
                else APIHelper.SKIP
        organization =\
            dictionary.get("organization")\
            if dictionary.get("organization")\
                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(anonymizer_status,
                   locality,
                   country,
                   administrative_area,
                   routing_method,
                   carrier,
                   organization,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _anonymizer_status=(
            self.anonymizer_status
            if hasattr(self, "anonymizer_status")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _country=(
            self.country
            if hasattr(self, "country")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            else None
        )
        _routing_method=(
            self.routing_method
            if hasattr(self, "routing_method")
            else None
        )
        _carrier=(
            self.carrier
            if hasattr(self, "carrier")
            else None
        )
        _organization=(
            self.organization
            if hasattr(self, "organization")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"anonymizer_status={_anonymizer_status!r}, "
            f"locality={_locality!r}, "
            f"country={_country!r}, "
            f"administrative_area={_administrative_area!r}, "
            f"routing_method={_routing_method!r}, "
            f"carrier={_carrier!r}, "
            f"organization={_organization!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _anonymizer_status=(
            self.anonymizer_status
            if hasattr(self, "anonymizer_status")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _country=(
            self.country
            if hasattr(self, "country")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            else None
        )
        _routing_method=(
            self.routing_method
            if hasattr(self, "routing_method")
            else None
        )
        _carrier=(
            self.carrier
            if hasattr(self, "carrier")
            else None
        )
        _organization=(
            self.organization
            if hasattr(self, "organization")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"anonymizer_status={_anonymizer_status!s}, "
            f"locality={_locality!s}, "
            f"country={_country!s}, "
            f"administrative_area={_administrative_area!s}, "
            f"routing_method={_routing_method!s}, "
            f"carrier={_carrier!s}, "
            f"organization={_organization!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
