from dataclasses import dataclass
from datetime import datetime
from enum import IntEnum, unique
from typing import Optional, TypedDict

from src.internals.internal_types import DatabaseEntry


@dataclass
class Notification(DatabaseEntry):
    id: int
    account_id: int
    type: str
    created_at: datetime
    extra_info: Optional[dict]
    is_seen: bool = False


@unique
class NotificationTypes(IntEnum):
    ACCOUNT_ROLE_CHANGE = 1


class AccountRoleChange(TypedDict):
    old_role: str
    new_role: str
