"""agent preset oauth mcp integration

Revision ID: 2ef382e77dea
Revises: fe20e84914ad
Create Date: 2025-11-20 18:14:25.009400

"""

from collections.abc import Sequence

import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "2ef382e77dea"
down_revision: str | None = "fe20e84914ad"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "agent_preset",
        sa.Column(
            "mcp_integrations", postgresql.JSONB(astext_type=sa.Text()), nullable=True
        ),
    )
    op.drop_column("agent_preset", "model_settings")
    op.drop_column("agent_preset", "mcp_server_headers")
    op.drop_column("agent_preset", "mcp_server_url")
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "agent_preset",
        sa.Column("mcp_server_url", sa.VARCHAR(), autoincrement=False, nullable=True),
    )
    op.add_column(
        "agent_preset",
        sa.Column(
            "mcp_server_headers",
            postgresql.JSONB(astext_type=sa.Text()),
            autoincrement=False,
            nullable=True,
        ),
    )
    op.add_column(
        "agent_preset",
        sa.Column(
            "model_settings",
            postgresql.JSONB(astext_type=sa.Text()),
            autoincrement=False,
            nullable=True,
        ),
    )
    op.drop_column("agent_preset", "mcp_integrations")
    # ### end Alembic commands ###
