import uuid
from datetime import UTC, datetime
from sqlalchemy import Column, String, DateTime
from app.database import Base


def utc_now() -> datetime:
    return datetime.now(UTC)


class BaseModel(Base):
    __abstract__ = True

    id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
    created_at = Column(DateTime, default=utc_now, nullable=False)
    updated_at = Column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
