"""add_ocr_fields_to_receipt

Revision ID: 4b8e5f2a1d93
Revises: 3a653da79002
Create Date: 2025-12-15 10:00:00.000000+00:00

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
import sqlmodel


# revision identifiers, used by Alembic.
revision: str = '4b8e5f2a1d93'
down_revision: Union[str, None] = '3a653da79002'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # Add OCR-related columns to receipts table
    with op.batch_alter_table('receipts', schema=None) as batch_op:
        batch_op.add_column(sa.Column('cui', sqlmodel.sql.sqltypes.AutoString(length=20), nullable=True))
        batch_op.add_column(sa.Column('ocr_raw_text', sa.Text(), nullable=True))
        batch_op.add_column(sa.Column('payment_methods', sqlmodel.sql.sqltypes.AutoString(length=500), nullable=True))


def downgrade() -> None:
    # Remove OCR-related columns from receipts table
    with op.batch_alter_table('receipts', schema=None) as batch_op:
        batch_op.drop_column('payment_methods')
        batch_op.drop_column('ocr_raw_text')
        batch_op.drop_column('cui')
