"""visaacceptancemergedspec.

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

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


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

    Attributes:
        http_accept_browser_value (str): Value of the Accept header sent by the
            customer’s web browser. **Note** If the customer’s browser provides a
            value, you must include it in your request.
        ip_address (str): IP address of the customer.  #### Used by **Authorization,
            Capture, and Credit** Optional field.
        user_agent_browser_value (str): Value of the User-Agent header sent by the
            customer’s web browser. Note If the customer’s browser provides a value,
            you must include it in your request.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "http_accept_browser_value": "httpAcceptBrowserValue",
        "ip_address": "ipAddress",
        "user_agent_browser_value": "userAgentBrowserValue",
    }

    _optionals = [
        "http_accept_browser_value",
        "ip_address",
        "user_agent_browser_value",
    ]

    def __init__(
        self,
        http_accept_browser_value=APIHelper.SKIP,
        ip_address=APIHelper.SKIP,
        user_agent_browser_value=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a DeviceInformation5 instance."""
        # Initialize members of the class
        if http_accept_browser_value is not APIHelper.SKIP:
            self.http_accept_browser_value = http_accept_browser_value
        if ip_address is not APIHelper.SKIP:
            self.ip_address = ip_address
        if user_agent_browser_value is not APIHelper.SKIP:
            self.user_agent_browser_value = user_agent_browser_value

        # 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
        http_accept_browser_value =\
            dictionary.get("httpAcceptBrowserValue")\
            if dictionary.get("httpAcceptBrowserValue")\
                else APIHelper.SKIP
        ip_address =\
            dictionary.get("ipAddress")\
            if dictionary.get("ipAddress")\
                else APIHelper.SKIP
        user_agent_browser_value =\
            dictionary.get("userAgentBrowserValue")\
            if dictionary.get("userAgentBrowserValue")\
                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(http_accept_browser_value,
                   ip_address,
                   user_agent_browser_value,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _http_accept_browser_value=(
            self.http_accept_browser_value
            if hasattr(self, "http_accept_browser_value")
            else None
        )
        _ip_address=(
            self.ip_address
            if hasattr(self, "ip_address")
            else None
        )
        _user_agent_browser_value=(
            self.user_agent_browser_value
            if hasattr(self, "user_agent_browser_value")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"http_accept_browser_value={_http_accept_browser_value!r}, "
            f"ip_address={_ip_address!r}, "
            f"user_agent_browser_value={_user_agent_browser_value!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _http_accept_browser_value=(
            self.http_accept_browser_value
            if hasattr(self, "http_accept_browser_value")
            else None
        )
        _ip_address=(
            self.ip_address
            if hasattr(self, "ip_address")
            else None
        )
        _user_agent_browser_value=(
            self.user_agent_browser_value
            if hasattr(self, "user_agent_browser_value")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"http_accept_browser_value={_http_accept_browser_value!s}, "
            f"ip_address={_ip_address!s}, "
            f"user_agent_browser_value={_user_agent_browser_value!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
