"""cellpointapi.

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

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper


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

    Buyer screen data.

    Attributes:
        screen_width (int): The total width of the buyer's device screen in pixels.
            This should be obtained by using the browser's `screen.width` property.
        screen_height (int): The total height of the buyer's device screen in pixels.
            This should be obtained by using the browser's `screen.height` property.
        color_depth (int): The color depth of the buyer's browser in bits per pixel.
            This should be obtained by using the browser's `screen.colorDepth`
            property.  Accepted values: 1, 4, 8, 15, 16, 24, 30, 32 or 48 bit color
            depth."
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "screen_width": "screenWidth",
        "screen_height": "screenHeight",
        "color_depth": "colorDepth",
    }

    def __init__(
        self,
        screen_width=None,
        screen_height=None,
        color_depth=None,
        additional_properties=None):
        """Initialize a Screen instance."""
        # Initialize members of the class
        self.screen_width = screen_width
        self.screen_height = screen_height
        self.color_depth = color_depth

        # 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
        screen_width =\
            dictionary.get("screenWidth")\
            if dictionary.get("screenWidth")\
                else None
        screen_height =\
            dictionary.get("screenHeight")\
            if dictionary.get("screenHeight")\
                else None
        color_depth =\
            dictionary.get("colorDepth")\
            if dictionary.get("colorDepth")\
                else None

        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(screen_width,
                   screen_height,
                   color_depth,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _screen_width=self.screen_width
        _screen_height=self.screen_height
        _color_depth=self.color_depth
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"screen_width={_screen_width!r}, "
            f"screen_height={_screen_height!r}, "
            f"color_depth={_color_depth!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _screen_width=self.screen_width
        _screen_height=self.screen_height
        _color_depth=self.color_depth
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"screen_width={_screen_width!s}, "
            f"screen_height={_screen_height!s}, "
            f"color_depth={_color_depth!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
