"""initial

Revision ID: 0d312b10e473
Revises: 
Create Date: 2025-06-19 06:45:37.350291

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0d312b10e473'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('enterprise_users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=25), nullable=False),
    sa.Column('email', sa.String(length=120), nullable=False),
    sa.Column('company', sa.String(length=100), nullable=False),
    sa.Column('password_hash', sa.String(length=128), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('password_changed_at', sa.DateTime(), nullable=True),
    sa.Column('is_admin', sa.Boolean(), nullable=True),
    sa.Column('last_login', sa.DateTime(), nullable=True),
    sa.Column('is_active', sa.Boolean(), nullable=True),
    sa.Column('failed_login_attempts', sa.Integer(), nullable=True),
    sa.Column('last_failed_login', sa.DateTime(), nullable=True),
    sa.Column('reset_token', sa.String(length=100), nullable=True),
    sa.Column('reset_token_expires', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('reset_token'),
    sa.UniqueConstraint('username')
    )
    op.create_table('mold_quotations',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('mold_shop_name', sa.String(length=100), nullable=False),
    sa.Column('mold_shop_country', sa.String(length=50), nullable=False),
    sa.Column('t1_shoe_factory_name', sa.String(length=100), nullable=False),
    sa.Column('t1_shoe_factory_country', sa.String(length=50), nullable=False),
    sa.Column('t2_component_factory_name', sa.String(length=100), nullable=False),
    sa.Column('t2_component_factory_country', sa.String(length=50), nullable=False),
    sa.Column('model_name', sa.String(length=100), nullable=False),
    sa.Column('tooling_id', sa.String(length=5), nullable=False),
    sa.Column('season', sa.String(length=10), nullable=False),
    sa.Column('stage', sa.String(length=10), nullable=False),
    sa.Column('type', sa.String(length=20), nullable=False),
    sa.Column('issue_date', sa.Date(), nullable=False),
    sa.Column('approved_by_mold_shop', sa.String(length=100), nullable=False),
    sa.Column('approved_by_t1_tooling', sa.String(length=100), nullable=False),
    sa.Column('approved_by_lo_tooling', sa.String(length=100), nullable=False),
    sa.Column('mold_main_type', sa.String(length=50), nullable=False),
    sa.Column('mold_sub_type', sa.String(length=50), nullable=False),
    sa.Column('mold_specific_type', sa.String(length=50), nullable=False),
    sa.Column('complexity_high_sidewall', sa.Boolean(), nullable=True),
    sa.Column('sliders_count', sa.Integer(), nullable=False),
    sa.Column('cavity_count', sa.Float(), nullable=False),
    sa.Column('digital_texture_type', sa.String(length=50), nullable=False),
    sa.Column('base_price', sa.Float(), nullable=False),
    sa.Column('tax_rate', sa.Float(), nullable=True),
    sa.Column('total_cost', sa.Float(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('is_archived', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['enterprise_users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    with op.batch_alter_table('mold_quotations', schema=None) as batch_op:
        batch_op.create_index('ix_quotation_created_at', ['created_at'], unique=False)
        batch_op.create_index('ix_quotation_issue_date', ['issue_date'], unique=False)
        batch_op.create_index('ix_quotation_user_id', ['user_id'], unique=False)

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('mold_quotations', schema=None) as batch_op:
        batch_op.drop_index('ix_quotation_user_id')
        batch_op.drop_index('ix_quotation_issue_date')
        batch_op.drop_index('ix_quotation_created_at')

    op.drop_table('mold_quotations')
    op.drop_table('enterprise_users')
    # ### end Alembic commands ###
