# Generated by Django 5.1.3 on 2024-11-09 16:09

import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
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="Notification",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "notification_type",
                    models.CharField(
                        choices=[
                            ("EMAIL", "Email"),
                            ("IN_APP", "In App"),
                            ("SMS", "SMS"),
                            ("PUSH", "Push"),
                        ],
                        max_length=50,
                    ),
                ),
                ("title", models.CharField(max_length=255)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("PENDING_SEND", "Pending Send"),
                            ("SENT", "Sent"),
                            ("CANCELLED", "Cancelled"),
                            ("FAILED", "Failed"),
                            ("READ", "Read"),
                        ],
                        default="PENDING_SEND",
                        max_length=50,
                    ),
                ),
                ("body_template", models.CharField(max_length=255)),
                ("subject_template", models.CharField(blank=True, max_length=255)),
                ("preheader_template", models.CharField(blank=True, max_length=255)),
                ("context_name", models.CharField(blank=True, max_length=255)),
                ("context_kwargs", models.JSONField(default=dict)),
                ("send_after", models.DateTimeField(null=True)),
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        db_index=True,
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="created",
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        db_index=True,
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="modified",
                    ),
                ),
                (
                    "context_used",
                    models.JSONField(
                        null=True,
                        verbose_name="context used when notification was sent",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "adapter_extra_parameters",
                    models.JSONField(
                        null=True,
                        verbose_name="Extra parameters for the notification adapter",
                    ),
                ),
                (
                    "adapter_used",
                    models.CharField(
                        max_length=255,
                        null=True,
                        verbose_name="Adapter used to send the notification",
                    ),
                ),
            ],
            options={
                "ordering": ("-created",),
            },
        ),
    ]
