# 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 List
from pydantic import BaseModel, Field, StrictStr, conlist
from cryptoapis.models.list_all_assets_from_all_wallets_ri_coins_inner import ListAllAssetsFromAllWalletsRICoinsInner
from cryptoapis.models.list_all_assets_from_all_wallets_ri_fungible_tokens_inner import ListAllAssetsFromAllWalletsRIFungibleTokensInner
from cryptoapis.models.list_all_assets_from_all_wallets_ri_non_fungible_tokens_inner import ListAllAssetsFromAllWalletsRINonFungibleTokensInner

class ListAllAssetsByWalletIDRI(BaseModel):
    """
    ListAllAssetsByWalletIDRI
    """
    coins: conlist(ListAllAssetsFromAllWalletsRICoinsInner) = Field(...)
    fungible_tokens: conlist(ListAllAssetsFromAllWalletsRIFungibleTokensInner) = Field(..., alias="fungibleTokens", description="Represents fungible tokens'es detailed information")
    non_fungible_tokens: conlist(ListAllAssetsFromAllWalletsRINonFungibleTokensInner) = Field(..., alias="nonFungibleTokens", description="Represents non-fungible tokens'es detailed information.")
    wallet_id: StrictStr = Field(..., alias="walletId", description="Defines the unique ID of the Wallet.")
    wallet_name: StrictStr = Field(..., alias="walletName", description="Represents the name of the wallet.")
    __properties = ["coins", "fungibleTokens", "nonFungibleTokens", "walletId", "walletName"]

    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) -> ListAllAssetsByWalletIDRI:
        """Create an instance of ListAllAssetsByWalletIDRI 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 each item in coins (list)
        _items = []
        if self.coins:
            for _item in self.coins:
                if _item:
                    _items.append(_item.to_dict())
            _dict['coins'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in fungible_tokens (list)
        _items = []
        if self.fungible_tokens:
            for _item in self.fungible_tokens:
                if _item:
                    _items.append(_item.to_dict())
            _dict['fungibleTokens'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in non_fungible_tokens (list)
        _items = []
        if self.non_fungible_tokens:
            for _item in self.non_fungible_tokens:
                if _item:
                    _items.append(_item.to_dict())
            _dict['nonFungibleTokens'] = _items
        return _dict

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

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

        _obj = ListAllAssetsByWalletIDRI.parse_obj({
            "coins": [ListAllAssetsFromAllWalletsRICoinsInner.from_dict(_item) for _item in obj.get("coins")] if obj.get("coins") is not None else None,
            "fungible_tokens": [ListAllAssetsFromAllWalletsRIFungibleTokensInner.from_dict(_item) for _item in obj.get("fungibleTokens")] if obj.get("fungibleTokens") is not None else None,
            "non_fungible_tokens": [ListAllAssetsFromAllWalletsRINonFungibleTokensInner.from_dict(_item) for _item in obj.get("nonFungibleTokens")] if obj.get("nonFungibleTokens") is not None else None,
            "wallet_id": obj.get("walletId"),
            "wallet_name": obj.get("walletName")
        })
        return _obj

