"""Add needs_human flag and intervention_note to tasks

Revision ID: b4c5d6e7f8a9
Revises: a3b4c5d6e7f8
Create Date: 2026-03-03 00:00:00.000000
"""
from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

revision: str = "b4c5d6e7f8a9"
down_revision: Union[str, None] = "a3b4c5d6e7f8"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column(
        "tasks",
        sa.Column("needs_human", sa.Boolean(), server_default="false", nullable=False),
    )
    op.add_column(
        "tasks",
        sa.Column("intervention_note", sa.Text(), nullable=True),
    )
    op.create_index("ix_tasks_needs_human", "tasks", ["needs_human"])


def downgrade() -> None:
    op.drop_index("ix_tasks_needs_human", table_name="tasks")
    op.drop_column("tasks", "intervention_note")
    op.drop_column("tasks", "needs_human")
