# coding: utf-8

"""
    全部  API 文档

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: v1
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


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

from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self

class Currency(BaseModel):
    """
    货币实体，用于表示和管理不同类型的货币信息。
    """ # noqa: E501
    id: Optional[StrictInt] = Field(default=None, description="货币的唯一标识符。")
    name: Optional[Annotated[str, Field(strict=True, max_length=100)]] = Field(default=None, description="货币的名称，例如 '人民币', '美元' 等。")
    code: Optional[Annotated[str, Field(strict=True, max_length=50)]] = Field(default=None, description="货币的ISO标准代码，例如 'CNY', 'USD' 等。")
    symbol: Optional[Annotated[str, Field(strict=True, max_length=10)]] = Field(default=None, description="货币的符号，例如 '$', '€', '¥' 等。")
    issuer: Optional[Annotated[str, Field(strict=True, max_length=100)]] = Field(default=None, description="发行该货币的机构或国家名称。")
    currency_type: Optional[Annotated[str, Field(strict=True, max_length=50)]] = Field(default=None, description="货币的类型，例如 '法定货币', '加密货币' 等。", alias="currencyType")
    tags: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(default=None, description="用于分类或标记货币的标签。")
    status: Optional[StrictBool] = Field(default=None, description="指示货币当前是否可用。")
    enable_virtual_recharge: Optional[StrictBool] = Field(default=None, description="指示该货币是否允许进行虚拟充值。", alias="enableVirtualRecharge")
    enable_virtual_consume: Optional[StrictBool] = Field(default=None, description="指示该货币是否允许进行虚拟消费。", alias="enableVirtualConsume")
    description: Optional[Annotated[str, Field(strict=True, max_length=500)]] = Field(default=None, description="货币的详细描述信息。")
    fiat_exchange_rate: Optional[StrictInt] = Field(default=None, description="该货币与法定货币的兑换比率。", alias="fiatExchangeRate")
    fiat_daily_recharge_limit: Optional[StrictInt] = Field(default=None, description="每日通过法定货币充值的最大限额。", alias="fiatDailyRechargeLimit")
    total_supply: Optional[StrictInt] = Field(default=None, description="货币的总供应量，0 表示无限制。", alias="totalSupply")
    create_date: Optional[datetime] = Field(default=None, description="货币记录的创建日期，默认为当前时间。", alias="createDate")
    last_update: Optional[datetime] = Field(default=None, description="货币记录的最后更新日期，默认为当前时间。", alias="lastUpdate")
    __properties: ClassVar[List[str]] = ["id", "name", "code", "symbol", "issuer", "currencyType", "tags", "status", "enableVirtualRecharge", "enableVirtualConsume", "description", "fiatExchangeRate", "fiatDailyRechargeLimit", "totalSupply", "createDate", "lastUpdate"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

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

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # set to None if name (nullable) is None
        # and model_fields_set contains the field
        if self.name is None and "name" in self.model_fields_set:
            _dict['name'] = None

        # set to None if code (nullable) is None
        # and model_fields_set contains the field
        if self.code is None and "code" in self.model_fields_set:
            _dict['code'] = None

        # set to None if symbol (nullable) is None
        # and model_fields_set contains the field
        if self.symbol is None and "symbol" in self.model_fields_set:
            _dict['symbol'] = None

        # set to None if issuer (nullable) is None
        # and model_fields_set contains the field
        if self.issuer is None and "issuer" in self.model_fields_set:
            _dict['issuer'] = None

        # set to None if currency_type (nullable) is None
        # and model_fields_set contains the field
        if self.currency_type is None and "currency_type" in self.model_fields_set:
            _dict['currencyType'] = None

        # set to None if tags (nullable) is None
        # and model_fields_set contains the field
        if self.tags is None and "tags" in self.model_fields_set:
            _dict['tags'] = None

        # set to None if description (nullable) is None
        # and model_fields_set contains the field
        if self.description is None and "description" in self.model_fields_set:
            _dict['description'] = None

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of Currency from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "id": obj.get("id"),
            "name": obj.get("name"),
            "code": obj.get("code"),
            "symbol": obj.get("symbol"),
            "issuer": obj.get("issuer"),
            "currencyType": obj.get("currencyType"),
            "tags": obj.get("tags"),
            "status": obj.get("status"),
            "enableVirtualRecharge": obj.get("enableVirtualRecharge"),
            "enableVirtualConsume": obj.get("enableVirtualConsume"),
            "description": obj.get("description"),
            "fiatExchangeRate": obj.get("fiatExchangeRate"),
            "fiatDailyRechargeLimit": obj.get("fiatDailyRechargeLimit"),
            "totalSupply": obj.get("totalSupply"),
            "createDate": obj.get("createDate"),
            "lastUpdate": obj.get("lastUpdate")
        })
        return _obj


