"""add requesting_escalation status

Revision ID: cc3201489b72
Revises: bb2101378a61
Create Date: 2026-03-18 23:30:00.000000

"""
from typing import Sequence, Union

from alembic import op

# revision identifiers, used by Alembic.
revision: str = 'cc3201489b72'
down_revision: Union[str, None] = 'bb2101378a61'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # Drop old status constraint and recreate with new values
    op.drop_constraint('ck_ai_sessions_status', 'ai_sessions', type_='check')
    op.create_check_constraint(
        'ck_ai_sessions_status',
        'ai_sessions',
        "status IN ('active', 'paused', 'resolved', 'escalated', 'requesting_escalation', 'abandoned')",
    )


def downgrade() -> None:
    op.drop_constraint('ck_ai_sessions_status', 'ai_sessions', type_='check')
    op.create_check_constraint(
        'ck_ai_sessions_status',
        'ai_sessions',
        "status IN ('active', 'paused', 'resolved', 'escalated', 'abandoned')",
    )
