# -*- coding: utf-8 -*-

"""
cookiesapi

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from cookiesapi.models.media_item import MediaItem


class ResponsiveGraphic(object):

    """Implementation of the 'ResponsiveGraphic' model.

    Describes a rasterized responsive graphic asset.

    Attributes:
        portrait (MediaItem): Portrait-style asset.
        landscape (MediaItem): Landscape-style asset.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "portrait": 'portrait',
        "landscape": 'landscape'
    }

    def __init__(self,
                 portrait=None,
                 landscape=None):
        """Constructor for the ResponsiveGraphic class"""

        # Initialize members of the class
        self.portrait = portrait
        self.landscape = landscape

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates 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 dictionary is None:
            return None

        # Extract variables from the dictionary
        portrait = MediaItem.from_dictionary(dictionary.get('portrait')) if dictionary.get('portrait') else None
        landscape = MediaItem.from_dictionary(dictionary.get('landscape')) if dictionary.get('landscape') else None

        # Return an object of this model
        return cls(portrait,
                   landscape)
