"""visaacceptancemergedspec.

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

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


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

    Attributes:
        ip_address (str): IP address of the customer.  #### Used by **Authorization,
            Capture, and Credit** Optional field.
        device_type (str): The device type at the client side.
        id (str): ../../../commons/definitions/device.yaml#/properties/id
        user_agent (str): Customer’s browser as identified from the HTTP header data.
            For example, `Mozilla` is the value that identifies the Netscape browser.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "ip_address": "ipAddress",
        "device_type": "deviceType",
        "id": "id",
        "user_agent": "userAgent",
    }

    _optionals = [
        "ip_address",
        "device_type",
        "id",
        "user_agent",
    ]

    def __init__(
        self,
        ip_address=APIHelper.SKIP,
        device_type=APIHelper.SKIP,
        id=APIHelper.SKIP,
        user_agent=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a DeviceInformation7 instance."""
        # Initialize members of the class
        if ip_address is not APIHelper.SKIP:
            self.ip_address = ip_address
        if device_type is not APIHelper.SKIP:
            self.device_type = device_type
        if id is not APIHelper.SKIP:
            self.id = id
        if user_agent is not APIHelper.SKIP:
            self.user_agent = user_agent

        # 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
        ip_address =\
            dictionary.get("ipAddress")\
            if dictionary.get("ipAddress")\
                else APIHelper.SKIP
        device_type =\
            dictionary.get("deviceType")\
            if dictionary.get("deviceType")\
                else APIHelper.SKIP
        id =\
            dictionary.get("id")\
            if dictionary.get("id")\
                else APIHelper.SKIP
        user_agent =\
            dictionary.get("userAgent")\
            if dictionary.get("userAgent")\
                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(ip_address,
                   device_type,
                   id,
                   user_agent,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _ip_address=(
            self.ip_address
            if hasattr(self, "ip_address")
            else None
        )
        _device_type=(
            self.device_type
            if hasattr(self, "device_type")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _user_agent=(
            self.user_agent
            if hasattr(self, "user_agent")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"ip_address={_ip_address!r}, "
            f"device_type={_device_type!r}, "
            f"id={_id!r}, "
            f"user_agent={_user_agent!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _ip_address=(
            self.ip_address
            if hasattr(self, "ip_address")
            else None
        )
        _device_type=(
            self.device_type
            if hasattr(self, "device_type")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _user_agent=(
            self.user_agent
            if hasattr(self, "user_agent")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"ip_address={_ip_address!s}, "
            f"device_type={_device_type!s}, "
            f"id={_id!s}, "
            f"user_agent={_user_agent!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
