import enum

from sqlalchemy import String, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column, relationship

from src.db.base import Base


class UserRoleEnum(int, enum.Enum):
    ADMIN = 1
    EXECUTOR_DFIP = 2
    EXECUTOR_RF = 3


class Role(Base):
    __tablename__ = "role"
    __table_args__ = (
        UniqueConstraint("code", name="uq_role_code"),
        {"schema": "v3"},
    )

    id: Mapped[int] = mapped_column(primary_key=True)
    code: Mapped[str] = mapped_column(String)

#     users: Mapped[list["AppUser"]] = relationship("AppUser", back_populates="role")  # type: ignore
#     form_phases: Mapped[list["FormPhase"]] = relationship(  # type: ignore
#         "FormPhase", back_populates="role"
#     )
#     phase_templates: Mapped[list["PhaseTemplate"]] = relationship(  # type: ignore
#         "PhaseTemplate", back_populates="role"
#     )
