"""Declarative base + small column helpers.

Enum-like columns (status, review_state, category, touch kind) are plain text
here; the authoritative value lists + CHECK constraints are added in the
migration once the vocabulary module (ported from the review app) is final —
values are served to the client from one authority (frontend.md), never
re-typed per layer.
"""
from sqlalchemy import TIMESTAMP, text
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import DeclarativeBase, mapped_column


class Base(DeclarativeBase):
    pass


def uuid_pk():
    return mapped_column(
        UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()")
    )


def created_at():
    return mapped_column(
        TIMESTAMP(timezone=True), nullable=False, server_default=text("now()")
    )
