"""add_shift_update_to_notification_type

Revision ID: add_shift_update_001
Revises: add_staff_shifts_001
Create Date: 2025-12-09 20:55:00.000000

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'add_shift_update_001'
down_revision = 'add_staff_shifts_001'
branch_labels = None
depends_on = None


def upgrade() -> None:
    # Add 'shift_update' to notification_type enum in notifications table
    op.execute("""
        ALTER TABLE notifications 
        MODIFY COLUMN notification_type ENUM(
            'booking_confirmation', 
            'payment_receipt', 
            'pre_arrival_reminder', 
            'check_in_reminder', 
            'check_out_reminder', 
            'marketing_campaign', 
            'loyalty_update', 
            'shift_update',
            'system_alert', 
            'custom'
        ) NOT NULL
    """)
    
    # Also update notification_templates table if it exists
    op.execute("""
        ALTER TABLE notification_templates 
        MODIFY COLUMN notification_type ENUM(
            'booking_confirmation', 
            'payment_receipt', 
            'pre_arrival_reminder', 
            'check_in_reminder', 
            'check_out_reminder', 
            'marketing_campaign', 
            'loyalty_update', 
            'shift_update',
            'system_alert', 
            'custom'
        ) NOT NULL
    """)


def downgrade() -> None:
    # Remove 'shift_update' from notification_type enum
    op.execute("""
        ALTER TABLE notifications 
        MODIFY COLUMN notification_type ENUM(
            'booking_confirmation', 
            'payment_receipt', 
            'pre_arrival_reminder', 
            'check_in_reminder', 
            'check_out_reminder', 
            'marketing_campaign', 
            'loyalty_update', 
            'system_alert', 
            'custom'
        ) NOT NULL
    """)
    
    op.execute("""
        ALTER TABLE notification_templates 
        MODIFY COLUMN notification_type ENUM(
            'booking_confirmation', 
            'payment_receipt', 
            'pre_arrival_reminder', 
            'check_in_reminder', 
            'check_out_reminder', 
            'marketing_campaign', 
            'loyalty_update', 
            'system_alert', 
            'custom'
        ) NOT NULL
    """)

