"""Add notification preferences to users table

Revision ID: 84cd4a8c9a18
Revises: ae5dce0d9dd3
Create Date: 2025-07-12 18:36:07.840763

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "84cd4a8c9a18"
down_revision: Union[str, None] = "ae5dce0d9dd3"
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! ###
    # Add columns with server defaults for existing rows
    op.add_column(
        "users",
        sa.Column(
            "push_notifications_enabled",
            sa.Boolean(),
            nullable=False,
            server_default="true",
        ),
    )
    op.add_column(
        "users",
        sa.Column(
            "email_notifications_enabled",
            sa.Boolean(),
            nullable=False,
            server_default="false",
        ),
    )
    op.add_column(
        "users",
        sa.Column(
            "sms_notifications_enabled",
            sa.Boolean(),
            nullable=False,
            server_default="false",
        ),
    )
    op.add_column(
        "users", sa.Column("phone_number", sa.String(length=20), nullable=True)
    )
    op.add_column(
        "users", sa.Column("notification_email", sa.String(length=255), nullable=True)
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("users", "notification_email")
    op.drop_column("users", "phone_number")
    op.drop_column("users", "sms_notifications_enabled")
    op.drop_column("users", "email_notifications_enabled")
    op.drop_column("users", "push_notifications_enabled")
    # ### end Alembic commands ###
