from dataclasses import dataclass
from typing import Optional


@dataclass
class ViewUsersPasswords:
    userId: int
    userName: str
    name: str
    surName: str
    passwordId: int
    password: str
    seed: str | None


@dataclass
# Only use it as read only
class ViewUsersApiTokens:
    userId: int
    userName: str
    name: str
    surName: str
    tokenId: int
    token: str
    tokenName: str
    validityStart: str
    validityEnd: str
    historyState: str
    isSessionToken: bool


@dataclass
# Only use it as read only
class ViewUsersGroups:
    userId: int
    userName: str
    name: str
    surName: str
    groupId: int
    groupName: str


@dataclass
# Only use it as read only
class ViewAllJoinedColumns:
    userId: int
    userName: str
    name: str
    surName: str
    passwordId: int
    password: str
    tokenId: int
    token: str
    tokenName: str
    validityStart: str
    validityEnd: str
    historyState: str
    isSessionToken: bool
    groups_groupId: int
    groupName: str


@dataclass
class TableApiTokens:
    users_userId: int
    token: str
    validityStart: str
    validityEnd: str
    historyState: str
    isSessionToken: bool
    tokenId: Optional[int] = None
    tokenName: Optional[str] = None


@dataclass
class TablePasswords:
    passwordId: int
    users_userId: int
    password: str
    seed: str | None
