"""add contact fields to vendor

Revision ID: 28d44d503cac
Revises: 9f3a25ea4991
Create Date: 2025-12-03 22:26:02.161087

"""
from collections.abc import Sequence

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "28d44d503cac"
down_revision: str | None = "9f3a25ea4991"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    # Add nullable contact fields to vendor table
    # These allow vendor-specific branding/identity, overriding company defaults
    op.add_column("vendors", sa.Column("contact_email", sa.String(255), nullable=True))
    op.add_column("vendors", sa.Column("contact_phone", sa.String(50), nullable=True))
    op.add_column("vendors", sa.Column("website", sa.String(255), nullable=True))
    op.add_column("vendors", sa.Column("business_address", sa.Text(), nullable=True))
    op.add_column("vendors", sa.Column("tax_number", sa.String(100), nullable=True))


def downgrade() -> None:
    # Remove contact fields from vendor table
    op.drop_column("vendors", "tax_number")
    op.drop_column("vendors", "business_address")
    op.drop_column("vendors", "website")
    op.drop_column("vendors", "contact_phone")
    op.drop_column("vendors", "contact_email")
