"""email templates and drop recipients list

Revision ID: 0007_email_templates
Revises: 0006_email_from_name
Create Date: 2026-02-12
"""

from alembic import op
import sqlalchemy as sa


revision = "0007_email_templates"
down_revision = "0006_email_from_name"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column("email_notification_settings", sa.Column("warning_subject_template", sa.Text(), nullable=True))
    op.add_column("email_notification_settings", sa.Column("alert_subject_template", sa.Text(), nullable=True))
    op.add_column("email_notification_settings", sa.Column("warning_body_template", sa.Text(), nullable=True))
    op.add_column("email_notification_settings", sa.Column("alert_body_template", sa.Text(), nullable=True))
    op.drop_column("email_notification_settings", "alert_recipients")


def downgrade() -> None:
    op.add_column("email_notification_settings", sa.Column("alert_recipients", sa.JSON(), nullable=False, server_default="[]"))
    op.drop_column("email_notification_settings", "alert_body_template")
    op.drop_column("email_notification_settings", "warning_body_template")
    op.drop_column("email_notification_settings", "alert_subject_template")
    op.drop_column("email_notification_settings", "warning_subject_template")
