from __future__ import annotations

from sqlalchemy import BigInteger, Boolean, Float, Integer, String, Text
from sqlalchemy.orm import Mapped, mapped_column

from fastapi_common.fastapi_common_web.models import BaseModel


class LeauditRagChatApp(BaseModel):
    __tablename__ = "rag_chat_app"

    Id: Mapped[int] = mapped_column("id", BigInteger, primary_key=True, autoincrement=True)
    name: Mapped[str] = mapped_column(String(255))
    description: Mapped[str] = mapped_column(Text, default="")
    area: Mapped[str] = mapped_column(String(50), default="")
    datasetId: Mapped[int | None] = mapped_column("dataset_id", BigInteger)
    systemPrompt: Mapped[str] = mapped_column("system_prompt", Text, default="")
    llmModel: Mapped[str] = mapped_column("llm_model", String(100), default="")
    temperature: Mapped[float] = mapped_column(Float, default=0.3)
    maxTokens: Mapped[int] = mapped_column("max_tokens", Integer, default=2048)
    openingStatement: Mapped[str] = mapped_column("opening_statement", Text, default="")
    suggestedQuestions: Mapped[str] = mapped_column("suggested_questions", Text, default="[]")
    isDefault: Mapped[bool] = mapped_column("is_default", Boolean, default=False)
    sortOrder: Mapped[int] = mapped_column("sort_order", Integer, default=0)
    status: Mapped[int] = mapped_column(Integer, default=1)
    createdBy: Mapped[int | None] = mapped_column("created_by", BigInteger)
    updatedBy: Mapped[int | None] = mapped_column("updated_by", BigInteger)
