"""Таблиця users для автентифікації — окремо від доменної схеми ШТУ."""
from __future__ import annotations

from sqlmodel import Field, SQLModel


class Users(SQLModel, table=True):
    id: int | None = Field(default=None, primary_key=True)
    email: str = Field(unique=True, index=True)
    hashed_password: str                            # bcrypt-хеш, ніколи не відкритий текст
    role: str                                       # "Admin" / "Expert" / "CompanyRep"
    company_id: int | None = Field(default=None, foreign_key="companies.id")
    # company_id = None → доступ до всіх компаній; = X → тільки компанія X (CompanyRep)
