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

"""
coingeckopublicapiv3

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from coingeckopublicapiv3.api_helper import APIHelper
from coingeckopublicapiv3.models.image_2 import Image2


class AssetPlatform(object):

    """Implementation of the 'AssetPlatform' model.

    Attributes:
        id (str): asset platform ID
        chain_identifier (float): chainlist's chain ID
        name (str): chain name
        shortname (str): chain shortname
        native_coin_id (str): chain native coin ID
        image (Image2): image of the asset platform

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'id',
        "chain_identifier": 'chain_identifier',
        "name": 'name',
        "shortname": 'shortname',
        "native_coin_id": 'native_coin_id',
        "image": 'image'
    }

    _optionals = [
        'id',
        'chain_identifier',
        'name',
        'shortname',
        'native_coin_id',
        'image',
    ]

    _nullables = [
        'chain_identifier',
    ]

    def __init__(self,
                 id=APIHelper.SKIP,
                 chain_identifier=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 shortname=APIHelper.SKIP,
                 native_coin_id=APIHelper.SKIP,
                 image=APIHelper.SKIP):
        """Constructor for the AssetPlatform class"""

        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id 
        if chain_identifier is not APIHelper.SKIP:
            self.chain_identifier = chain_identifier 
        if name is not APIHelper.SKIP:
            self.name = name 
        if shortname is not APIHelper.SKIP:
            self.shortname = shortname 
        if native_coin_id is not APIHelper.SKIP:
            self.native_coin_id = native_coin_id 
        if image is not APIHelper.SKIP:
            self.image = image 

    @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 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
        chain_identifier = dictionary.get("chain_identifier") if "chain_identifier" in dictionary.keys() else APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        shortname = dictionary.get("shortname") if dictionary.get("shortname") else APIHelper.SKIP
        native_coin_id = dictionary.get("native_coin_id") if dictionary.get("native_coin_id") else APIHelper.SKIP
        image = Image2.from_dictionary(dictionary.get('image')) if 'image' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(id,
                   chain_identifier,
                   name,
                   shortname,
                   native_coin_id,
                   image)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'id={(self.id if hasattr(self, "id") else None)!r}, '
                f'chain_identifier={(self.chain_identifier if hasattr(self, "chain_identifier") else None)!r}, '
                f'name={(self.name if hasattr(self, "name") else None)!r}, '
                f'shortname={(self.shortname if hasattr(self, "shortname") else None)!r}, '
                f'native_coin_id={(self.native_coin_id if hasattr(self, "native_coin_id") else None)!r}, '
                f'image={(self.image if hasattr(self, "image") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'id={(self.id if hasattr(self, "id") else None)!s}, '
                f'chain_identifier={(self.chain_identifier if hasattr(self, "chain_identifier") else None)!s}, '
                f'name={(self.name if hasattr(self, "name") else None)!s}, '
                f'shortname={(self.shortname if hasattr(self, "shortname") else None)!s}, '
                f'native_coin_id={(self.native_coin_id if hasattr(self, "native_coin_id") else None)!s}, '
                f'image={(self.image if hasattr(self, "image") else None)!s})')
