from typing import Optional, Any, List

from ....core.action import Action
from ....core.resource import Resource
from ....core.interfaces.dto import Dto
from .time import GrantTime, GrantTimeDto
from ....core.interfaces.core import Core


class Grant[Properties: Any](Core[Properties]):
  subject: str
  action: Action | str
  object: Resource | str

  field: Optional[List[str]]
  filter: Optional[List[str]]
  location: Optional[List[str]]

  time: Optional[List[GrantTime]]


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


class GrantDto[Properties: Any](Dto[Properties]):
  subject: str
  action: Action | str
  object: Resource | str

  field: Optional[List[str]]
  filter: Optional[List[str]]
  location: Optional[List[str]]

  time: Optional[List[GrantTimeDto]]
