"""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.raw_datum import (
    RawDatum,
)


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

    Attributes:
        id (str): Value created by the client software that uniquely identifies the
            POS device. Visa Acceptance does not forward this value to the processor.
            Instead, the value is forwarded to the Visa Acceptance reporting
            functionality.  This field is supported only for authorizations and
            credits on these processors: - American Express Direct - Credit
            Mutuel-CIC - FDC Nashville Global - OmniPay Direct - SIX  Optional field.
            String (32)
        host_name (str): DNS resolved hostname from `ipAddress`.
        ip_address (str): IP address of the customer.  #### Used by **Authorization,
            Capture, and Credit** Optional field.
        user_agent (str): Customer’s browser as identified from the HTTP header data.
            For example, `Mozilla` is the value that identifies the Netscape browser.
        fingerprint_session_id (str): Field that contains the session ID that you
            send to Decision Manager to obtain the device fingerprint information.
            The string can contain uppercase and lowercase letters, digits, hyphen
            (-), and underscore (_). However, do not use the same uppercase and
            lowercase letters to indicate different session IDs.  The session ID must
            be unique for each merchant ID. You can use any string that you are
            already generating, such as an order number or web session ID.  The
            session ID must be unique for each page load, regardless of an
            individual’s web session ID. If a user navigates to a profiled page and
            is assigned a web session, navigates away from the profiled page, then
            navigates back to the profiled page, the generated session ID should be
            different and unique. You may use a web session ID, but it is preferable
            to use an application GUID (Globally Unique Identifier). This measure
            ensures that a unique ID is generated every time the page is loaded, even
            if it is the same user reloading the page.
        use_raw_fingerprint_session_id (bool): Boolean that indicates whether request
            contains the device fingerprint information. Values: - `true`: Use raw
            fingerprintSessionId when looking up device details. - `false` (default):
            Use merchant id + fingerprintSessionId as the session id for Device
            detail collection.
        device_type (str): The device type at the client side.
        app_url (str): This field will contain the deep link that would help the
            Customer App to wake up.
        metadata (str): Verifies that the payment is originating from a valid,
            user-approved application and device. Sending this field helps reduce
            fraud and declined transactions. Note The length is set for a hexadecimal
            representation of the GUID/UUID. This field accepts a 36-character string
            (with hyphens) or a 32-character string (without hyphens). Example
            123e4567-e89b-12d3-a456-426655440000 Example
            123e4567e89b12d3a456426655440000
        raw_data (List[RawDatum]): The model property of type List[RawDatum].
        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.
        http_accept_content (str): The exact content of the HTTP accept header.
        http_browser_email (str): Email address set in the customer’s browser, which
            may differ from customer email.
        http_browser_language (str): Value represents the browser language as defined
            in IETF BCP47. Example:en-US, refer   for more details.
        http_browser_java_enabled (bool): A Boolean value that represents the ability
            of the cardholder browser to execute Java. Value is returned from the
            navigator.javaEnabled property. Possible Values:True/False
        http_browser_java_script_enabled (bool): A Boolean value that represents the
            ability of the cardholder browser to execute JavaScript. Possible
            Values:True/False. **Note**: Merchants should be able to know the values
            from fingerprint details of cardholder's browser.
        http_browser_color_depth (str): Value represents the bit depth of the color
            palette for displaying images, in bits per pixel. Example : 24, refer
            for more details
        http_browser_screen_height (str): Total height of the Cardholder's scree in
            pixels, example: 864.
        http_browser_screen_width (str): Total width of the cardholder's screen in
            pixels. Example: 1536.
        http_browser_time_difference (str): Time difference between UTC time and the
            cardholder browser local time, in minutes, Example:300
        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 = {
        "id": "id",
        "host_name": "hostName",
        "ip_address": "ipAddress",
        "user_agent": "userAgent",
        "fingerprint_session_id": "fingerprintSessionId",
        "use_raw_fingerprint_session_id": "useRawFingerprintSessionId",
        "device_type": "deviceType",
        "app_url": "appUrl",
        "metadata": "metadata",
        "raw_data": "rawData",
        "http_accept_browser_value": "httpAcceptBrowserValue",
        "http_accept_content": "httpAcceptContent",
        "http_browser_email": "httpBrowserEmail",
        "http_browser_language": "httpBrowserLanguage",
        "http_browser_java_enabled": "httpBrowserJavaEnabled",
        "http_browser_java_script_enabled": "httpBrowserJavaScriptEnabled",
        "http_browser_color_depth": "httpBrowserColorDepth",
        "http_browser_screen_height": "httpBrowserScreenHeight",
        "http_browser_screen_width": "httpBrowserScreenWidth",
        "http_browser_time_difference": "httpBrowserTimeDifference",
        "user_agent_browser_value": "userAgentBrowserValue",
    }

    _optionals = [
        "id",
        "host_name",
        "ip_address",
        "user_agent",
        "fingerprint_session_id",
        "use_raw_fingerprint_session_id",
        "device_type",
        "app_url",
        "metadata",
        "raw_data",
        "http_accept_browser_value",
        "http_accept_content",
        "http_browser_email",
        "http_browser_language",
        "http_browser_java_enabled",
        "http_browser_java_script_enabled",
        "http_browser_color_depth",
        "http_browser_screen_height",
        "http_browser_screen_width",
        "http_browser_time_difference",
        "user_agent_browser_value",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        host_name=APIHelper.SKIP,
        ip_address=APIHelper.SKIP,
        user_agent=APIHelper.SKIP,
        fingerprint_session_id=APIHelper.SKIP,
        use_raw_fingerprint_session_id=APIHelper.SKIP,
        device_type=APIHelper.SKIP,
        app_url=APIHelper.SKIP,
        metadata=APIHelper.SKIP,
        raw_data=APIHelper.SKIP,
        http_accept_browser_value=APIHelper.SKIP,
        http_accept_content=APIHelper.SKIP,
        http_browser_email=APIHelper.SKIP,
        http_browser_language=APIHelper.SKIP,
        http_browser_java_enabled=APIHelper.SKIP,
        http_browser_java_script_enabled=APIHelper.SKIP,
        http_browser_color_depth=APIHelper.SKIP,
        http_browser_screen_height=APIHelper.SKIP,
        http_browser_screen_width=APIHelper.SKIP,
        http_browser_time_difference=APIHelper.SKIP,
        user_agent_browser_value=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a DeviceInformation instance."""
        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id
        if host_name is not APIHelper.SKIP:
            self.host_name = host_name
        if ip_address is not APIHelper.SKIP:
            self.ip_address = ip_address
        if user_agent is not APIHelper.SKIP:
            self.user_agent = user_agent
        if fingerprint_session_id is not APIHelper.SKIP:
            self.fingerprint_session_id = fingerprint_session_id
        if use_raw_fingerprint_session_id is not APIHelper.SKIP:
            self.use_raw_fingerprint_session_id = use_raw_fingerprint_session_id
        if device_type is not APIHelper.SKIP:
            self.device_type = device_type
        if app_url is not APIHelper.SKIP:
            self.app_url = app_url
        if metadata is not APIHelper.SKIP:
            self.metadata = metadata
        if raw_data is not APIHelper.SKIP:
            self.raw_data = raw_data
        if http_accept_browser_value is not APIHelper.SKIP:
            self.http_accept_browser_value = http_accept_browser_value
        if http_accept_content is not APIHelper.SKIP:
            self.http_accept_content = http_accept_content
        if http_browser_email is not APIHelper.SKIP:
            self.http_browser_email = http_browser_email
        if http_browser_language is not APIHelper.SKIP:
            self.http_browser_language = http_browser_language
        if http_browser_java_enabled is not APIHelper.SKIP:
            self.http_browser_java_enabled = http_browser_java_enabled
        if http_browser_java_script_enabled is not APIHelper.SKIP:
            self.http_browser_java_script_enabled = http_browser_java_script_enabled
        if http_browser_color_depth is not APIHelper.SKIP:
            self.http_browser_color_depth = http_browser_color_depth
        if http_browser_screen_height is not APIHelper.SKIP:
            self.http_browser_screen_height = http_browser_screen_height
        if http_browser_screen_width is not APIHelper.SKIP:
            self.http_browser_screen_width = http_browser_screen_width
        if http_browser_time_difference is not APIHelper.SKIP:
            self.http_browser_time_difference = http_browser_time_difference
        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
        id =\
            dictionary.get("id")\
            if dictionary.get("id")\
                else APIHelper.SKIP
        host_name =\
            dictionary.get("hostName")\
            if dictionary.get("hostName")\
                else APIHelper.SKIP
        ip_address =\
            dictionary.get("ipAddress")\
            if dictionary.get("ipAddress")\
                else APIHelper.SKIP
        user_agent =\
            dictionary.get("userAgent")\
            if dictionary.get("userAgent")\
                else APIHelper.SKIP
        fingerprint_session_id =\
            dictionary.get("fingerprintSessionId")\
            if dictionary.get("fingerprintSessionId")\
                else APIHelper.SKIP
        use_raw_fingerprint_session_id =\
            dictionary.get("useRawFingerprintSessionId")\
            if "useRawFingerprintSessionId" in dictionary.keys()\
                else APIHelper.SKIP
        device_type =\
            dictionary.get("deviceType")\
            if dictionary.get("deviceType")\
                else APIHelper.SKIP
        app_url =\
            dictionary.get("appUrl")\
            if dictionary.get("appUrl")\
                else APIHelper.SKIP
        metadata =\
            dictionary.get("metadata")\
            if dictionary.get("metadata")\
                else APIHelper.SKIP
        raw_data = None
        if dictionary.get("rawData") is not None:
            raw_data = [
                RawDatum.from_dictionary(x)
                    for x in dictionary.get("rawData")
            ]
        else:
            raw_data = APIHelper.SKIP
        http_accept_browser_value =\
            dictionary.get("httpAcceptBrowserValue")\
            if dictionary.get("httpAcceptBrowserValue")\
                else APIHelper.SKIP
        http_accept_content =\
            dictionary.get("httpAcceptContent")\
            if dictionary.get("httpAcceptContent")\
                else APIHelper.SKIP
        http_browser_email =\
            dictionary.get("httpBrowserEmail")\
            if dictionary.get("httpBrowserEmail")\
                else APIHelper.SKIP
        http_browser_language =\
            dictionary.get("httpBrowserLanguage")\
            if dictionary.get("httpBrowserLanguage")\
                else APIHelper.SKIP
        http_browser_java_enabled =\
            dictionary.get("httpBrowserJavaEnabled")\
            if "httpBrowserJavaEnabled" in dictionary.keys()\
                else APIHelper.SKIP
        http_browser_java_script_enabled =\
            dictionary.get("httpBrowserJavaScriptEnabled")\
            if "httpBrowserJavaScriptEnabled" in dictionary.keys()\
                else APIHelper.SKIP
        http_browser_color_depth =\
            dictionary.get("httpBrowserColorDepth")\
            if dictionary.get("httpBrowserColorDepth")\
                else APIHelper.SKIP
        http_browser_screen_height =\
            dictionary.get("httpBrowserScreenHeight")\
            if dictionary.get("httpBrowserScreenHeight")\
                else APIHelper.SKIP
        http_browser_screen_width =\
            dictionary.get("httpBrowserScreenWidth")\
            if dictionary.get("httpBrowserScreenWidth")\
                else APIHelper.SKIP
        http_browser_time_difference =\
            dictionary.get("httpBrowserTimeDifference")\
            if dictionary.get("httpBrowserTimeDifference")\
                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(id,
                   host_name,
                   ip_address,
                   user_agent,
                   fingerprint_session_id,
                   use_raw_fingerprint_session_id,
                   device_type,
                   app_url,
                   metadata,
                   raw_data,
                   http_accept_browser_value,
                   http_accept_content,
                   http_browser_email,
                   http_browser_language,
                   http_browser_java_enabled,
                   http_browser_java_script_enabled,
                   http_browser_color_depth,
                   http_browser_screen_height,
                   http_browser_screen_width,
                   http_browser_time_difference,
                   user_agent_browser_value,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _host_name=(
            self.host_name
            if hasattr(self, "host_name")
            else None
        )
        _ip_address=(
            self.ip_address
            if hasattr(self, "ip_address")
            else None
        )
        _user_agent=(
            self.user_agent
            if hasattr(self, "user_agent")
            else None
        )
        _fingerprint_session_id=(
            self.fingerprint_session_id
            if hasattr(self, "fingerprint_session_id")
            else None
        )
        _use_raw_fingerprint_session_id=(
            self.use_raw_fingerprint_session_id
            if hasattr(self, "use_raw_fingerprint_session_id")
            else None
        )
        _device_type=(
            self.device_type
            if hasattr(self, "device_type")
            else None
        )
        _app_url=(
            self.app_url
            if hasattr(self, "app_url")
            else None
        )
        _metadata=(
            self.metadata
            if hasattr(self, "metadata")
            else None
        )
        _raw_data=(
            self.raw_data
            if hasattr(self, "raw_data")
            else None
        )
        _http_accept_browser_value=(
            self.http_accept_browser_value
            if hasattr(self, "http_accept_browser_value")
            else None
        )
        _http_accept_content=(
            self.http_accept_content
            if hasattr(self, "http_accept_content")
            else None
        )
        _http_browser_email=(
            self.http_browser_email
            if hasattr(self, "http_browser_email")
            else None
        )
        _http_browser_language=(
            self.http_browser_language
            if hasattr(self, "http_browser_language")
            else None
        )
        _http_browser_java_enabled=(
            self.http_browser_java_enabled
            if hasattr(self, "http_browser_java_enabled")
            else None
        )
        _http_browser_java_script_enabled=(
            self.http_browser_java_script_enabled
            if hasattr(self, "http_browser_java_script_enabled")
            else None
        )
        _http_browser_color_depth=(
            self.http_browser_color_depth
            if hasattr(self, "http_browser_color_depth")
            else None
        )
        _http_browser_screen_height=(
            self.http_browser_screen_height
            if hasattr(self, "http_browser_screen_height")
            else None
        )
        _http_browser_screen_width=(
            self.http_browser_screen_width
            if hasattr(self, "http_browser_screen_width")
            else None
        )
        _http_browser_time_difference=(
            self.http_browser_time_difference
            if hasattr(self, "http_browser_time_difference")
            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"id={_id!r}, "
            f"host_name={_host_name!r}, "
            f"ip_address={_ip_address!r}, "
            f"user_agent={_user_agent!r}, "
            f"fingerprint_session_id={_fingerprint_session_id!r}, "
            f"use_raw_fingerprint_session_id={_use_raw_fingerprint_session_id!r}, "
            f"device_type={_device_type!r}, "
            f"app_url={_app_url!r}, "
            f"metadata={_metadata!r}, "
            f"raw_data={_raw_data!r}, "
            f"http_accept_browser_value={_http_accept_browser_value!r}, "
            f"http_accept_content={_http_accept_content!r}, "
            f"http_browser_email={_http_browser_email!r}, "
            f"http_browser_language={_http_browser_language!r}, "
            f"http_browser_java_enabled={_http_browser_java_enabled!r}, "
            f"http_browser_java_script_enabled={_http_browser_java_script_enabled!r}, "
            f"http_browser_color_depth={_http_browser_color_depth!r}, "
            f"http_browser_screen_height={_http_browser_screen_height!r}, "
            f"http_browser_screen_width={_http_browser_screen_width!r}, "
            f"http_browser_time_difference={_http_browser_time_difference!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."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _host_name=(
            self.host_name
            if hasattr(self, "host_name")
            else None
        )
        _ip_address=(
            self.ip_address
            if hasattr(self, "ip_address")
            else None
        )
        _user_agent=(
            self.user_agent
            if hasattr(self, "user_agent")
            else None
        )
        _fingerprint_session_id=(
            self.fingerprint_session_id
            if hasattr(self, "fingerprint_session_id")
            else None
        )
        _use_raw_fingerprint_session_id=(
            self.use_raw_fingerprint_session_id
            if hasattr(self, "use_raw_fingerprint_session_id")
            else None
        )
        _device_type=(
            self.device_type
            if hasattr(self, "device_type")
            else None
        )
        _app_url=(
            self.app_url
            if hasattr(self, "app_url")
            else None
        )
        _metadata=(
            self.metadata
            if hasattr(self, "metadata")
            else None
        )
        _raw_data=(
            self.raw_data
            if hasattr(self, "raw_data")
            else None
        )
        _http_accept_browser_value=(
            self.http_accept_browser_value
            if hasattr(self, "http_accept_browser_value")
            else None
        )
        _http_accept_content=(
            self.http_accept_content
            if hasattr(self, "http_accept_content")
            else None
        )
        _http_browser_email=(
            self.http_browser_email
            if hasattr(self, "http_browser_email")
            else None
        )
        _http_browser_language=(
            self.http_browser_language
            if hasattr(self, "http_browser_language")
            else None
        )
        _http_browser_java_enabled=(
            self.http_browser_java_enabled
            if hasattr(self, "http_browser_java_enabled")
            else None
        )
        _http_browser_java_script_enabled=(
            self.http_browser_java_script_enabled
            if hasattr(self, "http_browser_java_script_enabled")
            else None
        )
        _http_browser_color_depth=(
            self.http_browser_color_depth
            if hasattr(self, "http_browser_color_depth")
            else None
        )
        _http_browser_screen_height=(
            self.http_browser_screen_height
            if hasattr(self, "http_browser_screen_height")
            else None
        )
        _http_browser_screen_width=(
            self.http_browser_screen_width
            if hasattr(self, "http_browser_screen_width")
            else None
        )
        _http_browser_time_difference=(
            self.http_browser_time_difference
            if hasattr(self, "http_browser_time_difference")
            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"id={_id!s}, "
            f"host_name={_host_name!s}, "
            f"ip_address={_ip_address!s}, "
            f"user_agent={_user_agent!s}, "
            f"fingerprint_session_id={_fingerprint_session_id!s}, "
            f"use_raw_fingerprint_session_id={_use_raw_fingerprint_session_id!s}, "
            f"device_type={_device_type!s}, "
            f"app_url={_app_url!s}, "
            f"metadata={_metadata!s}, "
            f"raw_data={_raw_data!s}, "
            f"http_accept_browser_value={_http_accept_browser_value!s}, "
            f"http_accept_content={_http_accept_content!s}, "
            f"http_browser_email={_http_browser_email!s}, "
            f"http_browser_language={_http_browser_language!s}, "
            f"http_browser_java_enabled={_http_browser_java_enabled!s}, "
            f"http_browser_java_script_enabled={_http_browser_java_script_enabled!s}, "
            f"http_browser_color_depth={_http_browser_color_depth!s}, "
            f"http_browser_screen_height={_http_browser_screen_height!s}, "
            f"http_browser_screen_width={_http_browser_screen_width!s}, "
            f"http_browser_time_difference={_http_browser_time_difference!s}, "
            f"user_agent_browser_value={_user_agent_browser_value!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
