from __future__ import annotations

import uuid

from sqlalchemy import ForeignKey, String
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import Mapped, mapped_column

from core.db.base import Base, SoftDeleteMixin, TimestampMixin


class Llm(TimestampMixin, SoftDeleteMixin, Base):
    __tablename__: str = "llms"

    id: Mapped[uuid.UUID] = mapped_column(
        UUID(as_uuid=True), primary_key=True, default=uuid.uuid4
    )
    factory_id: Mapped[uuid.UUID] = mapped_column(
        UUID(as_uuid=True),
        ForeignKey("llm_factory.id", ondelete="RESTRICT"),
        nullable=False,
        index=True,
    )
    model_code: Mapped[str] = mapped_column(
        String(50), nullable=False, unique=True, index=True
    )
