"""Add durable completion actions for professional software jobs.

Revision ID: 0034
Revises: 0033
Create Date: 2026-08-17
"""
from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

revision: str = "0034"
down_revision: str | None = "0033"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    op.add_column(
        "software_jobs",
        sa.Column(
            "completion_action", sa.Text(), nullable=False, server_default="report"
        ),
    )
    op.add_column(
        "software_jobs",
        sa.Column(
            "followup_status", sa.Text(), nullable=False, server_default="none"
        ),
    )
    op.create_index(
        "ix_software_jobs_followup",
        "software_jobs",
        ["followup_status", "terminal_at"],
    )


def downgrade() -> None:
    op.drop_index("ix_software_jobs_followup", table_name="software_jobs")
    op.drop_column("software_jobs", "followup_status")
    op.drop_column("software_jobs", "completion_action")
