from __future__ import annotations

from datetime import datetime

from sqlalchemy import DateTime, String, Text, func
from sqlalchemy.orm import Mapped, mapped_column

from app.db.base_class import Base


class SystemSettingSecret(Base):
    __tablename__ = "system_setting_secrets"

    id: Mapped[str] = mapped_column(String(32), primary_key=True, default="default")

    admin_password_hash: Mapped[str] = mapped_column(Text, default="")
    main_api_key_encrypted: Mapped[str] = mapped_column(Text, default="")
    backup_api_key_encrypted: Mapped[str] = mapped_column(Text, default="")
    vlm_api_key_encrypted: Mapped[str] = mapped_column(Text, default="")
    embedding_api_key_encrypted: Mapped[str] = mapped_column(Text, default="")
    reranker_api_key_encrypted: Mapped[str] = mapped_column(Text, default="")
    onlyoffice_jwt_secret_encrypted: Mapped[str] = mapped_column(Text, default="")
    smtp_password_encrypted: Mapped[str] = mapped_column(Text, default="")

    created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
    updated_at: Mapped[datetime] = mapped_column(
        DateTime(timezone=True),
        server_default=func.now(),
        onupdate=func.now(),
    )
