"""YakPanel - Backup plan model for scheduled backups"""
from sqlalchemy import String, Integer, Boolean
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import Base


class BackupPlan(Base):
    __tablename__ = "backup_plans"

    id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
    name: Mapped[str] = mapped_column(String(128), nullable=False)
    plan_type: Mapped[str] = mapped_column(String(32), nullable=False)  # site | database
    target_id: Mapped[int] = mapped_column(Integer, nullable=False)  # site_id or database_id
    schedule: Mapped[str] = mapped_column(String(64), nullable=False)  # cron expression, e.g. "0 2 * * *" = daily 2am
    enabled: Mapped[bool] = mapped_column(Boolean, default=True)
