# Generated by Django 4.2.10 on 2024-06-20 11:00

import apps.base.models.user_notification_policy
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('base', '0005_drop_unused_dynamic_settings'),
        ('user_management', '0022_alter_team_unique_together'),
        ('alerts', '0053_channelfilter_filtering_labels'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserNotificationBundle',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('important', models.BooleanField()),
                ('notification_channel', models.PositiveSmallIntegerField(default=None, null=True, validators=[apps.base.models.user_notification_policy.validate_channel_choice])),
                ('last_notified_at', models.DateTimeField(default=None, null=True)),
                ('notification_task_id', models.CharField(default=None, max_length=100, null=True)),
                ('eta', models.DateTimeField(default=None, null=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_bundles', to='user_management.user')),
            ],
        ),
        migrations.CreateModel(
            name='BundledNotification',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('bundle_uuid', models.CharField(db_index=True, default=None, max_length=100, null=True)),
                ('alert_group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='alerts.alertgroup')),
                ('alert_receive_channel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='alerts.alertreceivechannel')),
                ('notification_bundle', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to='alerts.usernotificationbundle')),
                ('notification_policy', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='base.usernotificationpolicy')),
            ],
        ),
        migrations.AddConstraint(
            model_name='usernotificationbundle',
            constraint=models.UniqueConstraint(fields=('user', 'important', 'notification_channel'), name='unique_user_notification_bundle'),
        ),
    ]
