"""add_insurance

Revision ID: ce642f83d9a3
Revises: 26ce48bf1215
Create Date: 2025-07-25 20:47:24.442613

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = 'ce642f83d9a3'
down_revision = '26ce48bf1215'
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    # Create the insurances table
    op.create_table('insurances',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('patient_id', sa.Integer(), nullable=False),
        sa.Column('insurance_type', sa.String(), nullable=False),
        sa.Column('company_name', sa.String(), nullable=False),
        sa.Column('employer_group', sa.String(), nullable=True),
        sa.Column('member_name', sa.String(), nullable=False),
        sa.Column('member_id', sa.String(), nullable=False),
        sa.Column('group_number', sa.String(), nullable=True),
        sa.Column('plan_name', sa.String(), nullable=True),
        sa.Column('policy_holder_name', sa.String(), nullable=True),
        sa.Column('relationship_to_holder', sa.String(), nullable=True),
        sa.Column('effective_date', sa.Date(), nullable=False),
        sa.Column('expiration_date', sa.Date(), nullable=True),
        sa.Column('status', sa.String(), nullable=False),
        sa.Column('is_primary', sa.Boolean(), nullable=False),
        sa.Column('coverage_details', sa.JSON(), nullable=True),
        sa.Column('contact_info', sa.JSON(), nullable=True),
        sa.Column('notes', sa.Text(), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=False),
        sa.Column('updated_at', sa.DateTime(), nullable=False),
        sa.ForeignKeyConstraint(['patient_id'], ['patients.id'], ),
        sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    # Drop the insurances table
    op.drop_table('insurances')
    # ### end Alembic commands ###
