from typing import Optional, List, Any


from ....core.scope import Scope
from ....core.interfaces.dto import Dto
from ....core.enums.status import Status
from ....enums.domain.apps import AppType
from ....core.interfaces.core import Core
from ....core.enums.grant_type import GrantType

from .change_log import AppChangeLog, AppChangeLogDto


class App[Properties: Any](Core[Properties]):
  type: AppType

  cid: str
  name: Optional[str]
  status: Status

  url: Optional[str]
  logo: Optional[str]
  site: Optional[str]
  slogan: Optional[str]

  scopes: Optional[List[Scope]]
  grant_types: Optional[List[GrantType]]

  access_token_ttl: Optional[int]
  refresh_token_ttl: Optional[int]

  change_logs: Optional[List[AppChangeLog]]


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


class AppDto[Properties: Any](Dto[Properties]):
  type: AppType

  cid: str
  name: Optional[str]
  status: Status

  url: Optional[str]
  logo: Optional[str]
  site: Optional[str]
  slogan: Optional[str]

  scopes: Optional[List[Scope]]
  grant_types: Optional[List[GrantType]]

  access_token_ttl: Optional[int]
  refresh_token_ttl: Optional[int]

  change_logs: Optional[List[AppChangeLogDto]]
