"""Add evaluation_imports table.

Revision ID: b048
Revises: b047
Create Date: 2026-06-05
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import UUID

revision = "b048"
down_revision = "b047"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.create_table(
        "evaluation_imports",
        sa.Column("id", UUID(as_uuid=True), primary_key=True),
        sa.Column("adversary_name", sa.String, nullable=False),
        sa.Column("adversary_display", sa.String, nullable=False),
        sa.Column("eval_round", sa.Integer, nullable=False),
        sa.Column("imported_at", sa.DateTime, nullable=False),
        sa.Column("imported_by", UUID(as_uuid=True), sa.ForeignKey("users.id"), nullable=True),
        sa.Column("tests_created", sa.Integer, default=0),
        sa.Column("techniques_covered", sa.Integer, default=0),
        sa.Column("status", sa.String, default="completed"),
        sa.Column("notes", sa.Text, nullable=True),
    )
    op.create_index("ix_evaluation_imports_adversary", "evaluation_imports", ["adversary_name"])
    op.create_index("ix_evaluation_imports_round", "evaluation_imports", ["eval_round"])


def downgrade() -> None:
    op.drop_index("ix_evaluation_imports_round", table_name="evaluation_imports")
    op.drop_index("ix_evaluation_imports_adversary", table_name="evaluation_imports")
    op.drop_table("evaluation_imports")
