"""Add taxi and favorite models

Revision ID: c88628a640b6
Revises: 8b3e5b0a3e67
Create Date: 2026-01-27 19:54:26.038491

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
import sqlmodel


# revision identifiers, used by Alembic.
revision: str = 'c88628a640b6'
down_revision: Union[str, None] = '8b3e5b0a3e67'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('taxis',
    sa.Column('id', sa.Uuid(), nullable=False),
    sa.Column('owner_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('phone_number', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('license_plate', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('cooperative', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
    sa.Column('corregimiento', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('shift', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_taxis_corregimiento'), 'taxis', ['corregimiento'], unique=False)
    op.create_index(op.f('ix_taxis_license_plate'), 'taxis', ['license_plate'], unique=True)
    op.create_table('favorites',
    sa.Column('id', sa.Uuid(), nullable=False),
    sa.Column('user_id', sa.Uuid(), nullable=False),
    sa.Column('item_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('item_id', sa.Uuid(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_favorites_item_id'), 'favorites', ['item_id'], unique=False)
    op.create_index(op.f('ix_favorites_item_type'), 'favorites', ['item_type'], unique=False)
    op.create_index(op.f('ix_favorites_user_id'), 'favorites', ['user_id'], unique=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_favorites_user_id'), table_name='favorites')
    op.drop_index(op.f('ix_favorites_item_type'), table_name='favorites')
    op.drop_index(op.f('ix_favorites_item_id'), table_name='favorites')
    op.drop_table('favorites')
    op.drop_index(op.f('ix_taxis_license_plate'), table_name='taxis')
    op.drop_index(op.f('ix_taxis_corregimiento'), table_name='taxis')
    op.drop_table('taxis')
    # ### end Alembic commands ###

