#!/usr/bin/env python
"""Create utils_notification table"""
import os
import django

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'branch_system.settings')
django.setup()

from django.db import connection

with connection.cursor() as cursor:
    cursor.execute("""
        CREATE TABLE IF NOT EXISTS utils_notification (
            id CHAR(32) NOT NULL PRIMARY KEY,
            notification_type VARCHAR(50) NOT NULL,
            title VARCHAR(200) NOT NULL,
            message LONGTEXT NOT NULL,
            priority VARCHAR(20) NOT NULL,
            created_at DATETIME(6) NOT NULL,
            read_at DATETIME(6) NULL,
            action_url VARCHAR(200) NULL,
            expires_at DATETIME(6) NULL,
            icon VARCHAR(50) NOT NULL,
            user_id CHAR(32) NULL,
            FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
        )
    """)
    print("✓ utils_notification table created successfully!")
