from typing import Optional, Any

from ....core.enums.state import State
from ....core.interfaces.dto import Dto
from ....core.interfaces.core import Core
from ....enums.special.files import FileShareLinkType


class File[Properties: Any](Core[Properties]):
  field: Optional[str]

  title: Optional[str]
  state: Optional[State]

  original: str
  encoding: Optional[str]
  mimetype: str

  size: int
  bucket: str

  key: str
  acl: str

  content_type: Optional[str]
  storage_class: Optional[str]

  location: str
  etag: Optional[str]


class ShareLinkReq:
  type: Optional[FileShareLinkType]

  # link
  ttl: Optional[int]
  key: Optional[int]

  # unlink
  token: Optional[str]


class ShareLinkRes:
  path: str
  key: Optional[str]


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


class FileDto[Properties: Any](Dto[Properties]):
  field: Optional[str]

  title: Optional[str]
  state: Optional[State]

  original: str
  encoding: Optional[str]
  mimetype: str

  size: int
  bucket: str

  key: str
  acl: str

  content_type: Optional[str]
  storage_class: Optional[str]

  location: str
  etag: Optional[str]
