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

"""
cookiesapi

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


class BrandSpec(object):

    """Implementation of the 'BrandSpec' model.

    Descriptor which specifies a first-party or third-party brand.

    Attributes:
        id (string): System ID for a brand. Do not key against this: it is
            guaranteed to change.
        bid (string): Assigned ID for this brand. Immutable and reliable.
        brand (Brand): OpenCannabis payload describing this brand.
        owned (bool): Whether this brand is owned by Cookies.
        icon (MediaItem): Media/asset icon for this brand.
        negative_icon (MediaItem): Negative-mode icon for this brand.
        live (bool): Whether this brand is live.
        sort_weight (int): Sort weight of this brand.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'id',
        "bid": 'bid',
        "brand": 'brand',
        "owned": 'owned',
        "icon": 'icon',
        "negative_icon": 'negativeIcon',
        "live": 'live',
        "sort_weight": 'sortWeight'
    }

    def __init__(self,
                 id=None,
                 bid=None,
                 brand=None,
                 owned=None,
                 icon=None,
                 negative_icon=None,
                 live=None,
                 sort_weight=None):
        """Constructor for the BrandSpec class"""

        # Initialize members of the class
        self.id = id
        self.bid = bid
        self.brand = brand
        self.owned = owned
        self.icon = icon
        self.negative_icon = negative_icon
        self.live = live
        self.sort_weight = sort_weight

    @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
        id = dictionary.get('id')
        bid = dictionary.get('bid')
        brand = Brand.from_dictionary(dictionary.get('brand')) if dictionary.get('brand') else None
        owned = dictionary.get('owned')
        icon = MediaItem.from_dictionary(dictionary.get('icon')) if dictionary.get('icon') else None
        negative_icon = MediaItem.from_dictionary(dictionary.get('negativeIcon')) if dictionary.get('negativeIcon') else None
        live = dictionary.get('live')
        sort_weight = dictionary.get('sortWeight')

        # Return an object of this model
        return cls(id,
                   bid,
                   brand,
                   owned,
                   icon,
                   negative_icon,
                   live,
                   sort_weight)
