# Generated by Django 2.2.11 on 2020-11-22 15:03

import uuid

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


class Migration(migrations.Migration):
    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("facility", "0205_auto_20201025_1709"),
    ]

    operations = [
        migrations.CreateModel(
            name="Notification",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "external_id",
                    models.UUIDField(db_index=True, default=uuid.uuid4, unique=True),
                ),
                ("created_date", models.DateTimeField(auto_now_add=True, null=True)),
                ("modified_date", models.DateTimeField(auto_now=True, null=True)),
                ("deleted", models.BooleanField(default=False)),
                ("read_at", models.DateTimeField(blank=True, null=True)),
                (
                    "event_type",
                    models.IntegerField(
                        choices=[(50, "SYSTEM_GENERATED"), (100, "CUSTOM_MESSAGE")],
                        default=50,
                    ),
                ),
                (
                    "event",
                    models.IntegerField(
                        choices=[
                            (0, "MESSAGE"),
                            (20, "PATIENT_CREATED"),
                            (30, "PATIENT_UPDATED"),
                            (40, "PATIENT_DELETED"),
                        ],
                        default=0,
                    ),
                ),
                ("message", models.TextField(max_length=2000)),
                ("caused_object_external_id", models.TextField(default=None)),
                (
                    "caused_by",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="notification_caused_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "intended_for",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="notification_intended_for",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
