"""add recommendation fields to trade_setups

Revision ID: 003
Revises: 002
Create Date: 2026-03-03 00:00:00.000000

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "003"
down_revision: Union[str, None] = "002"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column(
        "trade_setups",
        sa.Column("confidence_score", sa.Float(), nullable=True),
    )
    op.add_column(
        "trade_setups",
        sa.Column("targets_json", sa.Text(), nullable=True),
    )
    op.add_column(
        "trade_setups",
        sa.Column("conflict_flags_json", sa.Text(), nullable=True),
    )
    op.add_column(
        "trade_setups",
        sa.Column("recommended_action", sa.String(length=20), nullable=True),
    )
    op.add_column(
        "trade_setups",
        sa.Column("reasoning", sa.Text(), nullable=True),
    )
    op.add_column(
        "trade_setups",
        sa.Column("risk_level", sa.String(length=10), nullable=True),
    )
    op.add_column(
        "trade_setups",
        sa.Column("actual_outcome", sa.String(length=20), nullable=True),
    )


def downgrade() -> None:
    op.drop_column("trade_setups", "actual_outcome")
    op.drop_column("trade_setups", "risk_level")
    op.drop_column("trade_setups", "reasoning")
    op.drop_column("trade_setups", "recommended_action")
    op.drop_column("trade_setups", "conflict_flags_json")
    op.drop_column("trade_setups", "targets_json")
    op.drop_column("trade_setups", "confidence_score")
