# Generated by Django 4.2.2 on 2023-06-13 15:55

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):
    dependencies = [
        ("diop", "0015_rename_session_fqdn_session_machine"),
    ]

    operations = [
        migrations.CreateModel(
            name="Notification",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "method",
                    models.CharField(
                        choices=[("P", "Pop Up"), ("E", "Email")],
                        default="P",
                        help_text="How the notification should be delievered to the user.",
                        max_length=1,
                        verbose_name="Delivery Method",
                    ),
                ),
                (
                    "cc_adm",
                    models.BooleanField(
                        help_text="Flag if admins should be notified as well.",
                        verbose_name="Cc Operators",
                    ),
                ),
                (
                    "subject",
                    models.CharField(
                        max_length=256, verbose_name="The notification subject / title."
                    ),
                ),
                (
                    "body",
                    models.CharField(
                        max_length=8192, verbose_name="The notification body / content."
                    ),
                ),
                (
                    "t_created",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        help_text="Notification creation timestamp.",
                        verbose_name="Creation Time",
                    ),
                ),
                (
                    "t_sent",
                    models.DateTimeField(
                        help_text="Notification delivery timestamp (empty if not yet delieverd).",
                        null=True,
                        verbose_name="Sent Time",
                    ),
                ),
                (
                    "creator",
                    models.CharField(
                        blank=True,
                        help_text="Creator / origin of the notification.",
                        max_length=64,
                        verbose_name="Creator",
                    ),
                ),
                (
                    "session",
                    models.ForeignKey(
                        blank=True,
                        help_text="Session the notification relates to.",
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="diop.session",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="User which the notification is addressed to.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="diop.user",
                    ),
                ),
            ],
        ),
    ]
