"""YakPanel - Custom plugin model (third-party plugins added from URL)"""
from sqlalchemy import String, Integer, Boolean
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import Base


class CustomPlugin(Base):
    __tablename__ = "custom_plugins"

    id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
    plugin_id: Mapped[str] = mapped_column(String(64), unique=True, nullable=False)  # unique id from manifest
    name: Mapped[str] = mapped_column(String(128), nullable=False)
    version: Mapped[str] = mapped_column(String(32), default="1.0")
    desc: Mapped[str] = mapped_column(String(512), default="")
    source_url: Mapped[str] = mapped_column(String(512), default="")  # URL it was installed from
    enabled: Mapped[bool] = mapped_column(Boolean, default=True)
