"""
检索引擎数据库模型
"""
from sqlalchemy import Column, String, Integer, Text
from sqlalchemy.dialects.mysql import TINYINT
from app.base.async_mysql_connection import Base
from app.models.base import BaseModel


class SearchEngine(BaseModel):
    """检索引擎模型"""
    __tablename__ = "t_samp_search_engine"

    name = Column(String(100), nullable=False, comment="引擎名称")
    engine_type = Column(String(50), nullable=False, comment="引擎类型: google, bing, duckduckgo, custom")
    base_url = Column(String(255), nullable=True, comment="基础URL")
    api_key = Column(String(255), nullable=True, comment="API Key")
    description = Column(Text, nullable=True, comment="描述")
    status = Column(String(20), default="normal", comment="状态: normal(正常), disabled(禁用)")
    is_deleted = Column(TINYINT, default=0, comment="是否删除")

    def __repr__(self):
        return f"<SearchEngine {self.name}>"
