# Generated by Django 6.0.4 on 2026-06-06 02:55

import apps.notifications.models
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='NotificationTemplate',
            fields=[
                ('id', models.UUIDField(default=apps.notifications.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=100, unique=True)),
                ('title_template', models.CharField(max_length=255)),
                ('message_template', models.TextField()),
                ('notification_type', models.CharField(max_length=50)),
                ('icon', models.CharField(blank=True, default='bell', max_length=50)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'notifications_templates',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='NotificationPreference',
            fields=[
                ('id', models.UUIDField(default=apps.notifications.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('email_enabled', models.BooleanField(default=True)),
                ('push_enabled', models.BooleanField(default=True)),
                ('types_enabled', models.JSONField(default=dict)),
                ('quiet_hours_start', models.TimeField(blank=True, null=True)),
                ('quiet_hours_end', models.TimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='notification_preferences', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'notification_preferences',
            },
        ),
        migrations.CreateModel(
            name='FCMDevice',
            fields=[
                ('id', models.UUIDField(default=apps.notifications.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('token', models.CharField(max_length=512, unique=True)),
                ('platform', models.CharField(choices=[('web', 'Web'), ('android', 'Android'), ('ios', 'iOS')], default='web', max_length=10)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('last_seen', models.DateTimeField(auto_now=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fcm_devices', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'fcm_devices',
                'ordering': ['-last_seen'],
                'indexes': [models.Index(fields=['user', 'is_active'], name='fcm_devices_user_id_a9778f_idx')],
            },
        ),
        migrations.CreateModel(
            name='Notification',
            fields=[
                ('id', models.UUIDField(default=apps.notifications.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('title', models.CharField(max_length=255)),
                ('message', models.TextField()),
                ('notification_type', models.CharField(choices=[('info', 'Info'), ('success', 'Success'), ('warning', 'Warning'), ('error', 'Error'), ('message', 'Message'), ('task', 'Task'), ('event', 'Event'), ('project', 'Project'), ('hr', 'HR'), ('asset', 'Asset'), ('procurement', 'Procurement'), ('chat', 'Chat'), ('system', 'System')], default='info', max_length=50)),
                ('priority', models.CharField(choices=[('low', 'Low'), ('medium', 'Medium'), ('high', 'High'), ('urgent', 'Urgent')], default='medium', max_length=20)),
                ('icon', models.CharField(blank=True, default='bell', max_length=50)),
                ('link', models.CharField(blank=True, max_length=500)),
                ('is_read', models.BooleanField(default=False)),
                ('read_at', models.DateTimeField(blank=True, null=True)),
                ('is_deleted', models.BooleanField(default=False)),
                ('metadata', models.JSONField(blank=True, default=dict)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('related_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='related_notifications', to=settings.AUTH_USER_MODEL)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='app_notifications', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'app_notifications',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['user', '-created_at'], name='app_notific_user_id_b3e6c3_idx'), models.Index(fields=['user', 'is_read'], name='app_notific_user_id_740881_idx')],
            },
        ),
    ]
