# coding: utf-8

"""
    CryptoAPIs

    Crypto APIs is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of their blockchain applications. Crypto APIs provides unified endpoints and data, raw data, automatic tokens and coins forwardings, callback functionalities, and much more.  # noqa: E501

    The version of the OpenAPI document: 2021-03-20
    Contact: developers@cryptoapis.io
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import Optional
from pydantic import BaseModel, Field, StrictStr, validator
from cryptoapis.models.get_asset_details_by_asset_idri_asset_logo import GetAssetDetailsByAssetIDRIAssetLogo
from cryptoapis.models.get_asset_details_by_asset_idri_latest_rate import GetAssetDetailsByAssetIDRILatestRate
from cryptoapis.models.get_asset_details_by_asset_symbol_ris import GetAssetDetailsByAssetSymbolRIS

class GetAssetDetailsByAssetSymbolRI(BaseModel):
    """
    GetAssetDetailsByAssetSymbolRI
    """
    asset_id: StrictStr = Field(..., alias="assetId", description="Defines the unique ID of the specific asset.")
    asset_logo: GetAssetDetailsByAssetIDRIAssetLogo = Field(..., alias="assetLogo")
    asset_name: StrictStr = Field(..., alias="assetName", description="Specifies the name of the asset in question.")
    asset_original_symbol: StrictStr = Field(..., alias="assetOriginalSymbol", description="Specifies the asset's original symbol as introduced by its founders.")
    asset_symbol: StrictStr = Field(..., alias="assetSymbol", description="Specifies the asset's unique symbol in the Crypto APIs listings.")
    asset_type: StrictStr = Field(..., alias="assetType", description="Defines the type of the supported asset. This could be either \"crypto\" or \"fiat\".")
    latest_rate: GetAssetDetailsByAssetIDRILatestRate = Field(..., alias="latestRate")
    slug: Optional[StrictStr] = Field(None, description="Represents the asset`s unique slug string in Crypto APIs listings.")
    specific_data: GetAssetDetailsByAssetSymbolRIS = Field(..., alias="specificData")
    __properties = ["assetId", "assetLogo", "assetName", "assetOriginalSymbol", "assetSymbol", "assetType", "latestRate", "slug", "specificData"]

    @validator('asset_type')
    def asset_type_validate_enum(cls, value):
        """Validates the enum"""
        if value not in ('fiat', 'crypto'):
            raise ValueError("must be one of enum values ('fiat', 'crypto')")
        return value

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> GetAssetDetailsByAssetSymbolRI:
        """Create an instance of GetAssetDetailsByAssetSymbolRI from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of asset_logo
        if self.asset_logo:
            _dict['assetLogo'] = self.asset_logo.to_dict()
        # override the default output from pydantic by calling `to_dict()` of latest_rate
        if self.latest_rate:
            _dict['latestRate'] = self.latest_rate.to_dict()
        # override the default output from pydantic by calling `to_dict()` of specific_data
        if self.specific_data:
            _dict['specificData'] = self.specific_data.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> GetAssetDetailsByAssetSymbolRI:
        """Create an instance of GetAssetDetailsByAssetSymbolRI from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return GetAssetDetailsByAssetSymbolRI.parse_obj(obj)

        _obj = GetAssetDetailsByAssetSymbolRI.parse_obj({
            "asset_id": obj.get("assetId"),
            "asset_logo": GetAssetDetailsByAssetIDRIAssetLogo.from_dict(obj.get("assetLogo")) if obj.get("assetLogo") is not None else None,
            "asset_name": obj.get("assetName"),
            "asset_original_symbol": obj.get("assetOriginalSymbol"),
            "asset_symbol": obj.get("assetSymbol"),
            "asset_type": obj.get("assetType"),
            "latest_rate": GetAssetDetailsByAssetIDRILatestRate.from_dict(obj.get("latestRate")) if obj.get("latestRate") is not None else None,
            "slug": obj.get("slug"),
            "specific_data": GetAssetDetailsByAssetSymbolRIS.from_dict(obj.get("specificData")) if obj.get("specificData") is not None else None
        })
        return _obj

