# Generated by Django 4.1 on 2023-02-23 12:05

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),
        ("contenttypes", "0002_remove_content_type_name"),
    ]

    operations = [
        migrations.CreateModel(
            name="NotificationType",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("code", models.CharField(max_length=128, unique=True)),
                ("title", models.CharField(default="", max_length=128)),
                ("help_text", models.CharField(default="", max_length=512)),
                ("stale", models.BooleanField(default=False)),
                ("default_enable_web", models.BooleanField(default=False)),
                ("default_enable_mobile", models.BooleanField(default=False)),
                ("default_enable_email", models.BooleanField(default=False)),
                (
                    "contenttype",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to="contenttypes.contenttype",
                    ),
                ),
            ],
            options={
                "verbose_name": "Notification Type",
                "verbose_name_plural": "Notification Types",
            },
        ),
        migrations.CreateModel(
            name="NotificationUserToken",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("token", models.CharField(max_length=256)),
                ("device_type", models.CharField(choices=[("WEB", "Web"), ("MOBILE", "Mobile")], max_length=16)),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="notifications_tokens",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="NotificationTypeSetting",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("enable_web", models.BooleanField(default=False)),
                ("enable_mobile", models.BooleanField(default=False)),
                ("enable_email", models.BooleanField(default=False)),
                (
                    "notification_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="user_settings",
                        to="notifications.notificationtype",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="wbnotification_user_settings",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Notification",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(max_length=255)),
                ("body", models.TextField(default="")),
                ("endpoint", models.CharField(blank=True, max_length=255, null=True)),
                ("sent", models.DateTimeField(blank=True, null=True)),
                ("read", models.DateTimeField(blank=True, null=True)),
                (
                    "notification_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="notifications",
                        to="notifications.notificationtype",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="notifications_notifications",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Notification",
                "verbose_name_plural": "Notifications",
            },
        ),
    ]
