"""add_letzshop_credentials_carrier_fields

Revision ID: c00d2985701f
Revises: 55b92e155566
Create Date: 2025-12-20 18:49:53.432904

"""
from collections.abc import Sequence

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "c00d2985701f"
down_revision: str | None = "55b92e155566"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    # Add carrier settings and test mode to vendor_letzshop_credentials
    op.add_column("vendor_letzshop_credentials", sa.Column("test_mode_enabled", sa.Boolean(), nullable=True, server_default="0"))
    op.add_column("vendor_letzshop_credentials", sa.Column("default_carrier", sa.String(length=50), nullable=True))
    op.add_column("vendor_letzshop_credentials", sa.Column("carrier_greco_label_url", sa.String(length=500), nullable=True, server_default="https://dispatchweb.fr/Tracky/Home/"))
    op.add_column("vendor_letzshop_credentials", sa.Column("carrier_colissimo_label_url", sa.String(length=500), nullable=True))
    op.add_column("vendor_letzshop_credentials", sa.Column("carrier_xpresslogistics_label_url", sa.String(length=500), nullable=True))


def downgrade() -> None:
    op.drop_column("vendor_letzshop_credentials", "carrier_xpresslogistics_label_url")
    op.drop_column("vendor_letzshop_credentials", "carrier_colissimo_label_url")
    op.drop_column("vendor_letzshop_credentials", "carrier_greco_label_url")
    op.drop_column("vendor_letzshop_credentials", "default_carrier")
    op.drop_column("vendor_letzshop_credentials", "test_mode_enabled")
