# Generated by Django 3.2.20 on 2023-10-03 03:05

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

from NEMO.apps.nemo_ce.migration_utils import NEMOMigration


class Migration(NEMOMigration):

    dependencies = [
        ("NEMO", "0050_consumable_add_self_checkout_and_notes"),
        ("nemo_ce", "0010_ce_add_invitation_only_training"),
    ]

    operations = [
        migrations.AddField(
            model_name="tool",
            name="_allow_user_shadowing_verification_request",
            field=models.BooleanField(
                default=False,
                help_text="Allow users to request qualification on this tool through shadowing verification.",
            ),
        ),
        migrations.AddField(
            model_name="tool",
            name="_shadowing_verification_request_qualification_levels",
            field=models.ManyToManyField(
                blank=True,
                default=False,
                help_text="Qualification Levels that users can request on this tool through shadowing verification.",
                related_name="shadowing_verification_request_qualification_levels",
                to="NEMO.QualificationLevel",
            ),
        ),
        migrations.AddField(
            model_name="userpreferences",
            name="email_send_shadowing_verification_updates",
            field=models.PositiveIntegerField(
                choices=[(1, "Both emails"), (2, "Main email only")],
                default=1,
                help_text="Shadowing verification updates",
            ),
        ),
        migrations.AlterField(
            model_name="emaillog",
            name="category",
            field=models.IntegerField(
                choices=[
                    (0, "General"),
                    (1, "System"),
                    (2, "Direct Contact"),
                    (3, "Broadcast Email"),
                    (4, "Timed Services"),
                    (5, "Feedback"),
                    (6, "Abuse"),
                    (7, "Safety"),
                    (8, "Tasks"),
                    (9, "Access Requests"),
                    (10, "Sensors"),
                    (11, "Adjustment Requests"),
                    (12, "Training"),
                    (1001, "Shadowing Verification Requests"),
                ],
                default=0,
            ),
        ),
        migrations.AlterField(
            model_name="landingpagechoice",
            name="notifications",
            field=models.CharField(
                blank=True,
                choices=[
                    ("news", "News creation and updates - notifies all users"),
                    ("safetyissue", "New safety issues - notifies staff only"),
                    ("buddyrequest", "New buddy request - notifies all users"),
                    (
                        "buddyrequestmessage",
                        "New buddy request reply - notifies request creator and users who have replied",
                    ),
                    ("adjustmentrequest", "New adjustment request - notifies facility managers only"),
                    (
                        "adjustmentrequestmessage",
                        "New adjustment request reply - notifies request creator and users who have replied",
                    ),
                    (
                        "temporaryphysicalaccessrequest",
                        "New access request - notifies other users on request and reviewers",
                    ),
                    ("trainingrequest", "New training request - notifies trainers only"),
                    (
                        "shadowingverificationnrequest",
                        "New shadowing verification request - notifies facility managers only",
                    ),
                    ("traininginvitation", "New training invitation - notifies invited users"),
                    ("trainingall", "All training notifications"),
                ],
                help_text="Displays a the number of new notifications for the user. For example, if the user has two unread news notifications then the number '2' would appear for the news icon on the landing page.",
                max_length=100,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="notification",
            name="notification_type",
            field=models.CharField(
                choices=[
                    ("news", "News creation and updates - notifies all users"),
                    ("safetyissue", "New safety issues - notifies staff only"),
                    ("buddyrequest", "New buddy request - notifies all users"),
                    (
                        "buddyrequestmessage",
                        "New buddy request reply - notifies request creator and users who have replied",
                    ),
                    ("adjustmentrequest", "New adjustment request - notifies facility managers only"),
                    (
                        "adjustmentrequestmessage",
                        "New adjustment request reply - notifies request creator and users who have replied",
                    ),
                    (
                        "temporaryphysicalaccessrequest",
                        "New access request - notifies other users on request and reviewers",
                    ),
                    ("trainingrequest", "New training request - notifies trainers only"),
                    (
                        "shadowingverificationnrequest",
                        "New shadowing verification request - notifies facility managers only",
                    ),
                    ("traininginvitation", "New training invitation - notifies invited users"),
                    ("trainingall", "All training notifications"),
                ],
                max_length=100,
            ),
        ),
        migrations.CreateModel(
            name="ShadowingVerificationRequest",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "creation_time",
                    models.DateTimeField(
                        auto_now_add=True, help_text="The date and time when the request was created."
                    ),
                ),
                (
                    "last_updated",
                    models.DateTimeField(auto_now=True, help_text="The last time this request was modified."),
                ),
                ("description", models.TextField(help_text="The description of the request.")),
                ("event_date", models.DateField(help_text="The date of the shadowing event.")),
                ("status", models.IntegerField(choices=[(0, "Pending"), (1, "Approved"), (2, "Denied")], default=0)),
                (
                    "deleted",
                    models.BooleanField(
                        default=False, help_text="Indicates the request has been deleted and won't be shown anymore."
                    ),
                ),
                (
                    "creator",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="qualification_requests_created",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "last_updated_by",
                    models.ForeignKey(
                        blank=True,
                        help_text="The last user who modified this request.",
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="qualification_requests_updated",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "qualification_level",
                    models.ForeignKey(
                        blank=True,
                        help_text="The qualification level that the user is requesting.",
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="NEMO.qualificationlevel",
                    ),
                ),
                (
                    "reviewer",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="qualification_requests_reviewed",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "shadowed_qualified_user",
                    models.ForeignKey(
                        help_text="The qualified user who was shadowed.",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="qualification_requests_shadowed_qualified_user",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "tool",
                    models.ForeignKey(
                        help_text="The tool that the user is requesting a shadowing verification for.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="NEMO.tool",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
