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

"""
cookiesapi

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from cookiesapi.models.brand_asset import BrandAsset
from cookiesapi.models.name import Name
from cookiesapi.models.theme import Theme


class Brand(object):

    """Implementation of the 'Brand' model.

    OpenCannabis brand specification payload.

    Attributes:
        name (Name): Naming information for a brand.
        media (list of BrandAsset): Media/known assets for a brand.
        theme (Theme): Theme information for a brand.
        slug (string): Slug assigned to this brand.
        link (string): Full URL for this brand.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": 'name',
        "media": 'media',
        "theme": 'theme',
        "slug": 'slug',
        "link": 'link'
    }

    def __init__(self,
                 name=None,
                 media=None,
                 theme=None,
                 slug=None,
                 link=None):
        """Constructor for the Brand class"""

        # Initialize members of the class
        self.name = name
        self.media = media
        self.theme = theme
        self.slug = slug
        self.link = link

    @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
        name = Name.from_dictionary(dictionary.get('name')) if dictionary.get('name') else None
        media = None
        if dictionary.get('media') is not None:
            media = [BrandAsset.from_dictionary(x) for x in dictionary.get('media')]
        theme = Theme.from_dictionary(dictionary.get('theme')) if dictionary.get('theme') else None
        slug = dictionary.get('slug')
        link = dictionary.get('link')

        # Return an object of this model
        return cls(name,
                   media,
                   theme,
                   slug,
                   link)
