from typing import Any, TypedDict

from strenum import StrEnum


class AuthorizationPrincipal(TypedDict):
    id: Any
    type: str
    attributes: dict


class AuthorizationAction(StrEnum):
    ACCESS = "access"  # R/W
    LIST = "list"  # R/W
    VIEW = "view"  # R/W
    CREATE = "create"  # W
    UPDATE = "update"  # W
    DELETE = "delete"  # W


class AuthorizationRequest(TypedDict):
    action_name: AuthorizationAction | str
    resource_type: str
    resource: dict
    context: dict
