"""hwonb015 - application setup (leadSource / salesRep) selection

PRD-HWONB-015 — extends PRD-HWONB-014's reversal of the "association is a
fixed platform-wide settings template" decision (PRD-HWONB-002 §1) to
`leadSource` and `salesRep`. All three (association, leadSource, salesRep)
are now collected from the merchant in a new "Application Setup" step that
runs before Business Information, and are sent on the real
`POST /applications` Create Application call itself rather than being
patched in afterward.

Adds `tsys_lead_source`/`tsys_sales_rep` to `merchant_onboarding_applications`
to persist the merchant's selections locally, mirroring `tsys_association`'s
existing plain-nullable-column pattern.

Revision ID: hwonb015_application_setup
Revises: hwonb014_pricing_tier
Create Date: 2026-07-15
"""
from typing import Union, Sequence
import sqlalchemy as sa
from alembic import op

revision: str = 'hwonb015_application_setup'
down_revision: Union[str, Sequence[str], None] = 'hwonb014_pricing_tier'
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column(
        "merchant_onboarding_applications",
        sa.Column("tsys_lead_source", sa.String(length=10), nullable=True),
    )
    op.add_column(
        "merchant_onboarding_applications",
        sa.Column("tsys_sales_rep", sa.Integer(), nullable=True),
    )


def downgrade() -> None:
    op.drop_column("merchant_onboarding_applications", "tsys_sales_rep")
    op.drop_column("merchant_onboarding_applications", "tsys_lead_source")
