from typing import Optional, List, Any

from ....core.interfaces.dto import Dto
from ....core.interfaces.core import Core
from ....enums.financial.currencies import CurrencyType, CurrencyProvider, CurrencyCategory, CurrencyLib

from .unit import CurrencyUnit, CurrencyUnitDto


class Currency[Properties: Any](Core[Properties]):
  type: CurrencyType
  provider: CurrencyProvider

  code: Optional[str]
  symbol: str
  precision: float
  countries: Optional[List[str]]

  name: Optional[str]
  token: Optional[str]
  explore: Optional[str]
  network: Optional[str]
  contract: Optional[str]

  subunits: Optional[List[CurrencyUnit]]
  category: Optional[CurrencyCategory]

  lib: Optional[CurrencyLib]
  nodes: Optional[List[str]]


# ----------------------------------------
# Data Transfer Object Interface
# ----------------------------------------


class CurrencyDto[Properties: Any](Dto[Properties]):
  type: CurrencyType
  provider: Optional[CurrencyProvider]

  code: Optional[str]
  symbol: str
  precision: float
  countries: Optional[List[str]]

  name: Optional[str]
  token: Optional[str]
  explore: Optional[str]
  network: Optional[str]
  contract: Optional[str]

  subunits: Optional[List[CurrencyUnitDto]]
  category: Optional[CurrencyCategory]

  lib: Optional[CurrencyLib]
  nodes: Optional[List[str]]
