# Generated by Django 4.1.7 on 2023-04-19 05:36

import django.contrib.postgres.fields.ranges
import django.core.validators
import django.db.models.deletion
import django.utils.timezone
import django_fsm
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("directory", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("auth", "0012_alter_user_first_name_max_length"),
        ("contenttypes", "0002_remove_content_type_name"),
    ]

    operations = [
        migrations.CreateModel(
            name="ComplianceForm",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created", models.DateTimeField(auto_now_add=True, verbose_name="Created")),
                ("changed", models.DateTimeField(blank=True, null=True)),
                ("title", models.CharField(max_length=255, verbose_name="Title")),
                ("policy", models.TextField(blank=True, default="", null=True)),
                (
                    "status",
                    django_fsm.FSMField(
                        choices=[("DRAFT", "Draft"), ("PENDING", "Pending"), ("ACTIVE", "Active")],
                        default="DRAFT",
                        help_text="The Compliance Form status (default to Draft)",
                        max_length=50,
                        verbose_name="Status",
                    ),
                ),
                ("version", models.IntegerField(default=0)),
                (
                    "only_send_to_internals",
                    models.BooleanField(
                        default=True,
                        help_text="Sent the Compliance Form only to internal employees of the departments",
                    ),
                ),
                ("end", models.DateField(blank=True, null=True, verbose_name="End")),
                ("start", models.DateField(verbose_name="Start")),
                (
                    "assigned_to",
                    models.ManyToManyField(
                        blank=True,
                        help_text="List of group to whom this Compliance Form applies.            It is applied to all users if not specified",
                        related_name="compliance_forms",
                        to="auth.group",
                        verbose_name="Group to which the Compliance Form applies",
                    ),
                ),
            ],
            options={
                "verbose_name": "Compliance Form",
                "verbose_name_plural": "Compliance Forms",
                "permissions": [("admin_complianceform", "Can administer Compliance Forms")],
            },
        ),
        migrations.CreateModel(
            name="ComplianceFormSignature",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("version", models.IntegerField(default=0)),
                ("policy_text", models.TextField(blank=True, default="", null=True)),
                ("signed", models.DateTimeField(blank=True, null=True)),
                ("personal_notes", models.TextField(blank=True, default="", null=True)),
                (
                    "compliance_form",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="complianceforms",
                        to="wbcompliance.complianceform",
                    ),
                ),
                ("end", models.DateField(blank=True, null=True, verbose_name="End")),
                ("start", models.DateField(verbose_name="Start")),
            ],
            options={
                "verbose_name": "Compliance Form Signature",
                "verbose_name_plural": "Compliance Signatures",
            },
        ),
        migrations.CreateModel(
            name="ComplianceFormSection",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=255, verbose_name="Name section")),
                (
                    "compliance_form",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="compliance_forms",
                        to="wbcompliance.complianceform",
                        verbose_name="Compliance Form",
                    ),
                ),
            ],
            options={
                "verbose_name": "Section of the Compliance Form",
                "verbose_name_plural": "Sections of the Compliance Form",
            },
        ),
        migrations.CreateModel(
            name="ComplianceFormRule",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("text", models.TextField(default="")),
                ("ticked", models.BooleanField(default=False, verbose_name="Is applicable")),
                (
                    "section",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="rules",
                        to="wbcompliance.complianceformsection",
                        verbose_name="Section",
                    ),
                ),
            ],
            options={
                "verbose_name": "Rule of the section of the Compliance Form",
                "verbose_name_plural": "Rules of the section of the Compliance Form",
            },
        ),
        migrations.CreateModel(
            name="ComplianceFormSignatureSection",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=255, verbose_name="Name section")),
                (
                    "compliance_form_signature",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="compliance_form_signatures",
                        to="wbcompliance.complianceformsignature",
                        verbose_name="Compliance Form Signature",
                    ),
                ),
            ],
            options={
                "verbose_name": "Section of the Compliance Form Signature",
                "verbose_name_plural": "Sections of the Compliance Form Signature",
            },
        ),
        migrations.CreateModel(
            name="ComplianceFormSignatureRule",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("text", models.TextField(default="")),
                ("ticked", models.BooleanField(default=False, verbose_name="Is applicable")),
                ("comments", models.TextField(default="")),
                (
                    "section",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="rules",
                        to="wbcompliance.complianceformsignaturesection",
                        verbose_name="Section",
                    ),
                ),
            ],
            options={
                "verbose_name": "Rule of the section of the Compliance Form Signature",
                "verbose_name_plural": "Rules of the section of the Compliance Form Signature",
            },
        ),
        migrations.CreateModel(
            name="ComplianceFormType",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=255, verbose_name="Name")),
                (
                    "type",
                    models.CharField(
                        choices=[("TEXT", "Text"), ("FORM", "Form")],
                        default="TEXT",
                        max_length=32,
                        verbose_name="Type",
                    ),
                ),
            ],
            options={
                "verbose_name": "Compliance Form Type",
                "verbose_name_plural": "Compliance Form Types",
            },
        ),
        migrations.AddField(
            model_name="complianceform",
            name="type",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="wbcompliance.complianceformtype",
                verbose_name="Type",
            ),
        ),
        migrations.AlterField(
            model_name="complianceform",
            name="status",
            field=django_fsm.FSMField(
                choices=[("DRAFT", "Draft"), ("ACTIVATION_REQUESTED", "Activation Requested"), ("ACTIVE", "Active")],
                default="DRAFT",
                help_text="The Compliance Form status (default to Draft)",
                max_length=50,
                verbose_name="Status",
            ),
        ),
        migrations.CreateModel(
            name="ComplianceTaskGroup",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=255, verbose_name="Name")),
                ("order", models.PositiveIntegerField(blank=True, null=True, verbose_name="Order")),
            ],
            options={
                "verbose_name": "Compliance Task Group",
                "verbose_name_plural": "Compliance Task Groups",
            },
        ),
        migrations.CreateModel(
            name="ComplianceType",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=255, verbose_name="Name")),
                ("description", models.TextField(blank=True, default="", verbose_name="Description")),
            ],
            options={
                "verbose_name": "Compliance Type",
                "verbose_name_plural": "Compliance Types",
            },
        ),
        migrations.CreateModel(
            name="ComplianceAction",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(max_length=255, verbose_name="Title")),
                ("description", models.TextField(blank=True, default="", verbose_name="Description")),
                ("deadline", models.DateField(blank=True, null=True)),
                (
                    "progress",
                    models.FloatField(
                        default=0,
                        validators=[
                            django.core.validators.MinValueValidator(0.0),
                            django.core.validators.MaxValueValidator(1.0),
                        ],
                        verbose_name="Progress",
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("TO_BE_DONE", "To be done"),
                            ("WORK_IN_PROGRESS", "Work in Progress"),
                            ("DONE", "Done"),
                        ],
                        default="TO_BE_DONE",
                        max_length=32,
                        verbose_name="Status",
                    ),
                ),
                (
                    "type",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="wbcompliance.compliancetype",
                        verbose_name="Type",
                    ),
                ),
                ("active", models.BooleanField(default=True)),
                ("created", models.DateTimeField(auto_now_add=True, verbose_name="Created")),
                ("last_modified", models.DateTimeField(auto_now=True, verbose_name="Last modified")),
                (
                    "summary_description",
                    models.TextField(
                        blank=True,
                        help_text="Description for the Board of Directors",
                        null=True,
                        verbose_name="Summary Description",
                    ),
                ),
            ],
            options={
                "verbose_name": "Compliance Action",
                "verbose_name_plural": "Compliance Actions",
            },
        ),
        migrations.CreateModel(
            name="ComplianceEvent",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "type_event",
                    models.CharField(
                        choices=[("INCIDENT", "Incident"), ("INFO", "Info")],
                        default="INCIDENT",
                        max_length=32,
                        verbose_name="Type Event",
                    ),
                ),
                (
                    "level",
                    models.CharField(
                        choices=[("LOW", "Low"), ("MEDIUM", "Medium"), ("HIGH", "High")],
                        default="LOW",
                        max_length=32,
                        verbose_name="Level",
                    ),
                ),
                ("title", models.CharField(max_length=255, verbose_name="Title")),
                ("exec_summary", models.TextField(blank=True, default="", verbose_name="Executive Summary")),
                ("description", models.TextField(blank=True, default="", verbose_name="Description")),
                ("actions_taken", models.TextField(blank=True, default="", verbose_name="Actions Taken")),
                ("consequences", models.TextField(blank=True, default="", verbose_name="Consequences")),
                ("future_suggestions", models.TextField(blank=True, default="", verbose_name="Future Suggestions")),
                (
                    "type",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="wbcompliance.compliancetype",
                        verbose_name="Type",
                    ),
                ),
                ("active", models.BooleanField(default=True)),
                ("created", models.DateTimeField(auto_now_add=True, verbose_name="Created")),
                ("confidential", models.BooleanField(default=False)),
                ("last_modified", models.DateTimeField(auto_now=True, verbose_name="Last modified")),
                (
                    "exec_summary_board",
                    models.TextField(blank=True, null=True, verbose_name="Executive Summary for the Board"),
                ),
            ],
            options={
                "verbose_name": "Compliance Event",
                "verbose_name_plural": "Compliance Events",
            },
        ),
        migrations.CreateModel(
            name="ReviewComplianceTask",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(max_length=255, verbose_name="Title")),
                ("from_date", models.DateField(blank=True, null=True, verbose_name="From")),
                ("to_date", models.DateField(blank=True, null=True, verbose_name="To")),
                ("description", models.TextField(blank=True, default="", verbose_name="Description")),
                (
                    "year",
                    models.IntegerField(
                        blank=True,
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(1000),
                            django.core.validators.MaxValueValidator(9999),
                        ],
                        verbose_name="Year",
                    ),
                ),
                ("created", models.DateTimeField(auto_now_add=True, verbose_name="Created")),
                ("changed", models.DateTimeField(auto_now=True, null=True)),
                (
                    "status",
                    django_fsm.FSMField(
                        choices=[
                            ("DRAFT", "Draft"),
                            ("VALIDATION_REQUESTED", "Validation Requested"),
                            ("VALIDATED", "Validated"),
                        ],
                        default="DRAFT",
                        max_length=50,
                        verbose_name="Status",
                    ),
                ),
                (
                    "occurance",
                    models.CharField(
                        choices=[
                            ("YEARLY", "Yearly"),
                            ("QUARTERLY", "Quarterly"),
                            ("MONTHLY", "Monthly"),
                            ("NEVER", "Never"),
                        ],
                        default="MONTHLY",
                        max_length=32,
                        verbose_name="Occurance",
                    ),
                ),
                ("computed_str", models.CharField(blank=True, max_length=512, null=True)),
                ("is_instance", models.BooleanField(default=False)),
                (
                    "review_task",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="review_tasks",
                        to="wbcompliance.reviewcompliancetask",
                        verbose_name="Linked Indicator Report",
                    ),
                ),
                ("occured", models.DateTimeField(blank=True, null=True, verbose_name="Occured Instance Report")),
            ],
            options={
                "verbose_name": "Review Compliance Task",
                "verbose_name_plural": "Review Compliance Tasks",
            },
        ),
        migrations.CreateModel(
            name="ComplianceTask",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(max_length=255, verbose_name="Title")),
                ("description", models.TextField(blank=True, default="", verbose_name="Description")),
                (
                    "occurance",
                    models.CharField(
                        choices=[
                            ("YEARLY", "Yearly"),
                            ("QUARTERLY", "Quarterly"),
                            ("MONTHLY", "Monthly"),
                            ("NEVER", "Never"),
                        ],
                        default="MONTHLY",
                        max_length=32,
                        verbose_name="Occurance",
                    ),
                ),
                ("active", models.BooleanField(default=True)),
                (
                    "group",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="tasks_related",
                        to="wbcompliance.compliancetaskgroup",
                        verbose_name="Group",
                    ),
                ),
                (
                    "type",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="wbcompliance.compliancetype",
                        verbose_name="Type",
                    ),
                ),
                (
                    "review",
                    models.ManyToManyField(
                        blank=True,
                        help_text="list of reports that contain this task",
                        related_name="tasks",
                        to="wbcompliance.reviewcompliancetask",
                        verbose_name="Indicator Reports",
                    ),
                ),
                ("remarks", models.TextField(blank=True, null=True, verbose_name="Remarks")),
                (
                    "risk_level",
                    models.CharField(
                        blank=True,
                        choices=[("LOW", "Low"), ("MEDIUM", "Medium"), ("HIGH", "High")],
                        max_length=32,
                        null=True,
                        verbose_name="Risk Level",
                    ),
                ),
            ],
            options={
                "verbose_name": "Compliance Task",
                "verbose_name_plural": "Compliance Tasks",
            },
        ),
        migrations.CreateModel(
            name="ComplianceTaskInstance",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("occured", models.DateField(auto_now_add=True)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("NOT_CHECKED", "Not Checked"),
                            ("WARNING", "Warning"),
                            ("FOR_INFO", "For Info"),
                            ("NOTHING_TO_REPORT", "Nothing to Report"),
                            ("BREACH", "Breach"),
                        ],
                        default="NOT_CHECKED",
                        max_length=32,
                        verbose_name="Status",
                    ),
                ),
                ("text", models.TextField(blank=True, default="", verbose_name="Text")),
                (
                    "task",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="task_instances_related",
                        to="wbcompliance.compliancetask",
                        verbose_name="Compliance Task",
                    ),
                ),
                (
                    "summary_text",
                    models.TextField(
                        blank=True,
                        help_text="Information for the Board of Directors",
                        null=True,
                        verbose_name="Summary Text",
                    ),
                ),
                (
                    "review",
                    models.ManyToManyField(
                        blank=True,
                        help_text="list of indicator instance reports that contain this task",
                        related_name="task_instances",
                        to="wbcompliance.reviewcompliancetask",
                        verbose_name="Indicator Instance Reports",
                    ),
                ),
            ],
            options={
                "verbose_name": "Compliance Task Instance",
                "verbose_name_plural": "Compliance Task Instances",
            },
        ),
        migrations.RemoveField(
            model_name="complianceform",
            name="assigned_to",
        ),
        migrations.AddField(
            model_name="complianceform",
            name="assigned_to",
            field=models.ManyToManyField(
                blank=True,
                help_text="List of group to whom this Compliance Form applies.            It is applied to all users if not specified",
                related_name="compliance_forms",
                to="auth.group",
                verbose_name="Group to which the Compliance Form applies",
            ),
        ),
        migrations.CreateModel(
            name="RiskCheck",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("computed_str", models.CharField(blank=True, max_length=512, null=True)),
                (
                    "creation_datetime",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="Time at which the check was created/triggered",
                        verbose_name="Creation Date",
                    ),
                ),
                (
                    "evaluation_date",
                    models.DateField(
                        help_text="The date at which the rule was evaluated", verbose_name="Evaluation Date"
                    ),
                ),
            ],
            options={
                "verbose_name": "Risk Check",
                "verbose_name_plural": "Risk Checks",
            },
        ),
        migrations.CreateModel(
            name="RiskIncident",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("computed_str", models.CharField(blank=True, max_length=512, null=True)),
                (
                    "severity",
                    models.CharField(
                        choices=[("LOW", "Low"), ("MEDIUM", "Medium"), ("HIGH", "High")],
                        default="LOW",
                        help_text="The incident Severity",
                        max_length=8,
                        verbose_name="Severity",
                    ),
                ),
                ("comment", models.TextField(blank=True, null=True, verbose_name="Comment")),
                (
                    "date_range",
                    django.contrib.postgres.fields.ranges.DateRangeField(
                        blank=True, help_text="The incident spans date interval", null=True
                    ),
                ),
                ("breached_object_id", models.PositiveIntegerField(blank=True, null=True)),
                (
                    "breached_object_repr",
                    models.CharField(
                        blank=True,
                        help_text="String Representation of the breached object",
                        max_length=128,
                        null=True,
                        verbose_name="Breached Object Representation",
                    ),
                ),
                (
                    "status",
                    django_fsm.FSMField(
                        choices=[
                            ("OPEN", "Open"),
                            ("RESOLVED", "Resolved"),
                            ("IGNORED", "Ignored"),
                            ("CLOSED", "Closed"),
                        ],
                        default="OPEN",
                        max_length=50,
                        verbose_name="Status",
                    ),
                ),
                (
                    "breached_content_type",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.contenttype",
                    ),
                ),
            ],
            options={
                "verbose_name": "Risk Incident",
                "verbose_name_plural": "Risk Incidents",
            },
        ),
        migrations.CreateModel(
            name="RiskRule",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "permission_type",
                    models.CharField(
                        choices=[("INTERNAL", "Internal"), ("PUBLIC", "Public"), ("PRIVATE", "Private")],
                        default="PRIVATE",
                        max_length=8,
                    ),
                ),
                ("name", models.CharField(max_length=512)),
                ("description", models.CharField(default="", max_length=516, verbose_name="Quick Description")),
                ("is_enable", models.BooleanField(default=True, verbose_name="Enabled")),
                (
                    "is_passive",
                    models.BooleanField(
                        default=True,
                        help_text="If False, This rule can only be triggered through signal",
                        verbose_name="Passive",
                    ),
                ),
                (
                    "is_silent",
                    models.BooleanField(
                        default=True, help_text="If true, the notification won't be send through System nor Mail"
                    ),
                ),
                (
                    "is_mandatory",
                    models.BooleanField(
                        default=False,
                        help_text="A mandatory rule cannot be modified by anyone other than the administrators",
                    ),
                ),
                ("parameters", models.JSONField(blank=True, default=dict)),
                (
                    "creator",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="created_%(app_label)s_%(class)s",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Risk Rule",
                "verbose_name_plural": "Risk Rules",
                "abstract": False,
                "default_permissions": ("add", "change", "delete", "view", "administrate"),
            },
        ),
        migrations.AlterField(
            model_name="complianceform",
            name="only_send_to_internals",
            field=models.BooleanField(default=True, help_text="Sent the Compliance Form only to internal users"),
        ),
        migrations.CreateModel(
            name="TriggererIncidentRelationship",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("computed_str", models.CharField(blank=True, max_length=512, null=True)),
                (
                    "severity",
                    models.CharField(
                        choices=[("LOW", "Low"), ("MEDIUM", "Medium"), ("HIGH", "High")],
                        default="LOW",
                        help_text="The incident Severity",
                        max_length=8,
                        verbose_name="Severity",
                    ),
                ),
                ("comment", models.TextField(blank=True, null=True, verbose_name="Comment")),
                ("report", models.TextField(blank=True, null=True, verbose_name="Report")),
                (
                    "status",
                    django_fsm.FSMField(
                        choices=[
                            ("OPEN", "Open"),
                            ("RESOLVED", "Resolved"),
                            ("IGNORED", "Ignored"),
                            ("CLOSED", "Closed"),
                        ],
                        default="OPEN",
                        max_length=50,
                        verbose_name="Status",
                    ),
                ),
                (
                    "incident",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="triggerer_relationships",
                        to="wbcompliance.riskincident",
                    ),
                ),
                (
                    "rule_check",
                    models.ForeignKey(
                        help_text="The check that opened this incident",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="incidents",
                        to="wbcompliance.riskcheck",
                        verbose_name="Check",
                    ),
                ),
            ],
            options={
                "verbose_name": "Incident to Triggerer relationship",
                "verbose_name_plural": "Incident to Triggerer relationships",
            },
        ),
        migrations.CreateModel(
            name="RuleTriggererRelationship",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("computed_str", models.CharField(blank=True, max_length=512, null=True)),
                ("triggerer_id", models.PositiveIntegerField()),
                ("triggerer_repr", models.CharField(blank=True, max_length=256, null=True)),
                (
                    "rule",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="triggerer_relationships",
                        to="wbcompliance.riskrule",
                    ),
                ),
                (
                    "triggerer_content_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="risk_management_triggerers",
                        to="contenttypes.contenttype",
                    ),
                ),
            ],
            options={
                "verbose_name": "Triggerer to Rule relationship",
                "verbose_name_plural": "Triggerer to Rule relationships",
            },
        ),
        migrations.CreateModel(
            name="RuleThreshold",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("computed_str", models.CharField(blank=True, max_length=512, null=True)),
                (
                    "range",
                    django.contrib.postgres.fields.ranges.DecimalRangeField(
                        help_text="The range which triggers the specified severity. null bound represent infinity",
                        verbose_name="Threshold range",
                    ),
                ),
                (
                    "severity",
                    models.CharField(
                        choices=[("LOW", "Low"), ("MEDIUM", "Medium"), ("HIGH", "High")],
                        default="LOW",
                        help_text="The Triggered Severity when the rule is within the threshold range",
                        max_length=8,
                        verbose_name="Triggered Severity",
                    ),
                ),
                (
                    "rule",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="thresholds",
                        to="wbcompliance.riskrule",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="RuleBackend",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=128)),
                ("backend_class_path", models.CharField(max_length=512)),
                ("backend_class_name", models.CharField(default="RuleBackend", max_length=128)),
                (
                    "allowed_triggerer_content_type",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.contenttype",
                    ),
                ),
            ],
            options={
                "verbose_name": "Rule Backend",
                "verbose_name_plural": "Rule Backends",
            },
        ),
        migrations.AddField(
            model_name="riskrule",
            name="rule_backend",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, related_name="rules", to="wbcompliance.rulebackend"
            ),
        ),
        migrations.AddField(
            model_name="riskincident",
            name="rule",
            field=models.ForeignKey(
                help_text="The rule that opened this incident",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="incidents",
                to="wbcompliance.riskrule",
                verbose_name="Rule",
            ),
        ),
        migrations.AddField(
            model_name="riskcheck",
            name="rule_triggerer_relationship",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="checks",
                to="wbcompliance.ruletriggererrelationship",
                verbose_name="Rule-Triggerer Relationship",
            ),
        ),
        migrations.AddIndex(
            model_name="triggererincidentrelationship",
            index=models.Index(fields=["incident", "rule_check"], name="wbcomplianc_inciden_e01fa0_idx"),
        ),
        migrations.AlterUniqueTogether(
            name="triggererincidentrelationship",
            unique_together={("incident", "rule_check")},
        ),
        migrations.AddIndex(
            model_name="ruletriggererrelationship",
            index=models.Index(
                fields=["rule", "triggerer_content_type", "triggerer_id"], name="wbcomplianc_rule_id_c5fc0f_idx"
            ),
        ),
        migrations.AlterUniqueTogether(
            name="rulethreshold",
            unique_together={("rule", "severity")},
        ),
        migrations.AlterUniqueTogether(
            name="riskrule",
            unique_together={("rule_backend", "parameters")},
        ),
        migrations.AddField(
            model_name="rulethreshold",
            name="notifiable_groups",
            field=models.ManyToManyField(
                blank=True,
                help_text="Notified Groups for this rule and severity",
                related_name="notified_rule_thresholds",
                to="auth.group",
                verbose_name="Notifiable Groups",
            ),
        ),
        migrations.AddField(
            model_name="riskrule",
            name="apply_to_all_active_relationships",
            field=models.BooleanField(
                default=False,
                help_text="If True, will keep this rule syncrhonize with the backend definition of all active relationship",
            ),
        ),
        migrations.AddField(
            model_name="riskrule",
            name="automatically_close_incident",
            field=models.BooleanField(
                default=False, help_text="If True, this rule will automatically close all encountered incidents"
            ),
        ),
        migrations.AlterField(
            model_name="reviewcompliancetask",
            name="computed_str",
            field=models.CharField(blank=True, max_length=512, null=True, verbose_name="Name"),
        ),
        migrations.AlterField(
            model_name="riskcheck",
            name="computed_str",
            field=models.CharField(blank=True, max_length=512, null=True, verbose_name="Name"),
        ),
        migrations.AlterField(
            model_name="riskincident",
            name="computed_str",
            field=models.CharField(blank=True, max_length=512, null=True, verbose_name="Name"),
        ),
        migrations.AlterField(
            model_name="rulethreshold",
            name="computed_str",
            field=models.CharField(blank=True, max_length=512, null=True, verbose_name="Name"),
        ),
        migrations.AlterField(
            model_name="ruletriggererrelationship",
            name="computed_str",
            field=models.CharField(blank=True, max_length=512, null=True, verbose_name="Name"),
        ),
        migrations.AlterField(
            model_name="triggererincidentrelationship",
            name="computed_str",
            field=models.CharField(blank=True, max_length=512, null=True, verbose_name="Name"),
        ),
        migrations.CreateModel(
            name="RiskIncidentType",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=128)),
                ("severity_order", models.PositiveIntegerField(default=0, unique=True)),
                ("color", models.CharField(default="rgb(247, 232, 113)", max_length=20, verbose_name="Color")),
                ("is_ignorable", models.BooleanField(default=True, verbose_name="Can be ignored")),
                ("is_automatically_closed", models.BooleanField(default=False, verbose_name="Automatically closed")),
                (
                    "is_informational",
                    models.BooleanField(
                        default=False,
                        help_text="If true, the associated rule is not considered an incident",
                        verbose_name="Only Informational",
                    ),
                ),
            ],
            options={
                "verbose_name": "Risk Incident Type",
                "verbose_name_plural": "Risk Incidents Type",
                "ordering": ("severity_order",),
            },
        ),
        migrations.AddField(
            model_name="riskincident",
            name="is_notified",
            field=models.BooleanField(
                default=False,
                help_text="True if the incident is already notified to the users",
                verbose_name="Notified",
            ),
        ),
        migrations.AddField(
            model_name="rulethreshold",
            name="upgradable_after_days",
            field=models.PositiveIntegerField(
                blank=True,
                help_text="If set to a positive integer, the resulting incident will be elevated to the next rule severity after an incident remains open this number of days",
                null=True,
                verbose_name="Upgradable to next severity after X Days",
            ),
        ),
        migrations.RenameField(
            model_name="riskincident",
            old_name="severity",
            new_name="old_severity",
        ),
        migrations.RenameField(
            model_name="rulethreshold",
            old_name="severity",
            new_name="old_severity",
        ),
        migrations.RenameField(
            model_name="triggererincidentrelationship",
            old_name="severity",
            new_name="old_severity",
        ),
        migrations.AddField(
            model_name="rulethreshold",
            name="severity",
            field=models.ForeignKey(
                blank=True,
                help_text="The Triggered Severity when the rule is within the threshold range",
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="thresholds",
                to="wbcompliance.riskincidenttype",
                verbose_name="Triggered Severity",
            ),
        ),
        migrations.RemoveField(
            model_name="riskincident",
            name="old_severity",
        ),
        migrations.RemoveField(
            model_name="triggererincidentrelationship",
            name="old_severity",
        ),
        migrations.AlterUniqueTogether(
            name="rulethreshold",
            unique_together={("rule", "severity")},
        ),
        migrations.RemoveField(
            model_name="rulethreshold",
            name="old_severity",
        ),
        migrations.AddField(
            model_name="riskincident",
            name="severity",
            field=models.ForeignKey(
                default=None,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="%(class)s",
                to="wbcompliance.riskincidenttype",
                verbose_name="Severity",
            ),
        ),
        migrations.AlterField(
            model_name="rulethreshold",
            name="severity",
            field=models.ForeignKey(
                default=None,
                help_text="The Triggered Severity when the rule is within the threshold range",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="thresholds",
                to="wbcompliance.riskincidenttype",
                verbose_name="Triggered Severity",
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="triggererincidentrelationship",
            name="severity",
            field=models.ForeignKey(
                default=None,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="%(class)s",
                to="wbcompliance.riskincidenttype",
                verbose_name="Severity",
            ),
        ),
        migrations.AlterField(
            model_name="complianceform",
            name="assigned_to",
            field=models.ManyToManyField(
                blank=True,
                help_text="List of group to whom this Compliance Form applies. It is applied to all users if not specified",
                related_name="compliance_forms",
                to="auth.group",
                verbose_name="Group to which the Compliance Form applies",
            ),
        ),
        migrations.AddField(
            model_name="riskincident",
            name="ignore_duration",
            field=models.DurationField(
                blank=True,
                help_text="If set, will ignore the forthcoming incidents for the specified duration",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="riskincident",
            name="last_ignored_date",
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AlterModelOptions(
            name="complianceform",
            options={"verbose_name": "Compliance Form", "verbose_name_plural": "Compliance Forms"},
        ),
        migrations.AlterModelOptions(
            name="compliancetype",
            options={
                "permissions": [("admin_compliance", "Can administer Compliance")],
                "verbose_name": "Compliance Type",
                "verbose_name_plural": "Compliance Types",
            },
        ),
        migrations.RenameField(
            model_name="complianceform",
            old_name="only_send_to_internals",
            new_name="only_internal",
        ),
        migrations.AlterField(
            model_name="complianceform",
            name="only_internal",
            field=models.BooleanField(
                default=True, help_text="Send the Form only to internal users", verbose_name="Only internal"
            ),
        ),
        migrations.RenameField(
            model_name="complianceformsignature",
            old_name="personal_notes",
            new_name="remark",
        ),
        migrations.AlterField(
            model_name="complianceformsignature",
            name="remark",
            field=models.TextField(blank=True, default="", null=True, verbose_name="Remark"),
        ),
        migrations.RenameField(
            model_name="complianceformsignature",
            old_name="policy_text",
            new_name="policy",
        ),
        migrations.AlterField(
            model_name="complianceformsignature",
            name="policy",
            field=models.TextField(blank=True, default="", null=True, verbose_name="Policy"),
        ),
        migrations.RenameField(
            model_name="compliancetask",
            old_name="occurance",
            new_name="occurrence",
        ),
        migrations.RenameField(
            model_name="reviewcompliancetask",
            old_name="occurance",
            new_name="occurrence",
        ),
        migrations.AlterField(
            model_name="compliancetask",
            name="occurrence",
            field=models.CharField(
                choices=[("YEARLY", "Yearly"), ("QUARTERLY", "Quarterly"), ("MONTHLY", "Monthly"), ("NEVER", "Never")],
                default="MONTHLY",
                max_length=32,
                verbose_name="Occurrence",
            ),
        ),
        migrations.AlterField(
            model_name="reviewcompliancetask",
            name="occurrence",
            field=models.CharField(
                choices=[("YEARLY", "Yearly"), ("QUARTERLY", "Quarterly"), ("MONTHLY", "Monthly"), ("NEVER", "Never")],
                default="MONTHLY",
                max_length=32,
                verbose_name="Occurrence",
            ),
        ),
        migrations.AlterField(
            model_name="complianceform",
            name="policy",
            field=models.TextField(blank=True, default="", null=True, verbose_name="Policy"),
        ),
        migrations.AlterField(
            model_name="complianceform",
            name="assigned_to",
            field=models.ManyToManyField(
                blank=True,
                related_name="forms_of_group",
                to="auth.group",
                verbose_name="Group to which the Form applies",
            ),
        ),
        migrations.AlterField(
            model_name="complianceform",
            name="changed",
            field=models.DateTimeField(auto_now=True, default=django.utils.timezone.now, verbose_name="Changed"),
            preserve_default=False,
        ),
        migrations.AlterField(
            model_name="complianceformsignature",
            name="version",
            field=models.IntegerField(default=0, verbose_name="Version"),
        ),
        migrations.AlterField(
            model_name="reviewcompliancetask",
            name="changed",
            field=models.DateTimeField(auto_now=True, default=django.utils.timezone.now, verbose_name="Changed"),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="compliancetype",
            name="in_charge",
            field=models.ManyToManyField(
                blank=True,
                help_text="groups responsible for managing this type of compliance",
                related_name="compliance_types",
                to="auth.group",
                verbose_name="Group of administrators",
            ),
        ),
        migrations.AlterField(
            model_name="complianceformsignature",
            name="compliance_form",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="complianceforms",
                to="wbcompliance.complianceform",
                verbose_name="Form",
            ),
        ),
        migrations.AlterField(
            model_name="complianceformsignature",
            name="signed",
            field=models.DateTimeField(blank=True, null=True, verbose_name="Signed"),
        ),
        migrations.RenameField(
            model_name="complianceform",
            old_name="type",
            new_name="form_type",
        ),
        migrations.AlterField(
            model_name="complianceform",
            name="form_type",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to="wbcompliance.complianceformtype",
                verbose_name="Form Type",
            ),
        ),
        migrations.AlterField(
            model_name="reviewcompliancetask",
            name="is_instance",
            field=models.BooleanField(default=False, verbose_name="Is occurrence"),
        ),
        migrations.AlterField(
            model_name="reviewcompliancetask",
            name="review_task",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="review_tasks",
                to="wbcompliance.reviewcompliancetask",
                verbose_name="Parent Review",
            ),
        ),
        migrations.AlterField(
            model_name="complianceformrule",
            name="ticked",
            field=models.BooleanField(default=False, verbose_name="Expected Answer"),
        ),
        migrations.AlterField(
            model_name="complianceformsignaturerule",
            name="ticked",
            field=models.BooleanField(default=False, verbose_name="Answer"),
        ),
        migrations.AlterField(
            model_name="compliancetype",
            name="name",
            field=models.CharField(max_length=255, unique=True, verbose_name="Name"),
        ),
        migrations.AlterField(
            model_name="complianceaction",
            name="description",
            field=models.TextField(blank=True, default="", null=True, verbose_name="Description"),
        ),
        migrations.AlterField(
            model_name="complianceaction",
            name="summary_description",
            field=models.TextField(blank=True, null=True, verbose_name="Summary Description"),
        ),
        migrations.AlterField(
            model_name="complianceevent",
            name="exec_summary",
            field=models.TextField(blank=True, null=True, verbose_name="Executive Summary"),
        ),
        migrations.AlterField(
            model_name="complianceevent",
            name="exec_summary_board",
            field=models.TextField(blank=True, null=True, verbose_name="Executive Summary for the Board"),
        ),
        migrations.AlterField(
            model_name="complianceevent",
            name="confidential",
            field=models.BooleanField(default=False, verbose_name="Confidential"),
        ),
        migrations.AlterField(
            model_name="complianceaction",
            name="active",
            field=models.BooleanField(default=True, verbose_name="Active"),
        ),
        migrations.AlterField(
            model_name="reviewcompliancetask",
            name="occured",
            field=models.DateField(blank=True, null=True, verbose_name="Occured Instance"),
        ),
        migrations.AlterField(
            model_name="compliancetaskinstance",
            name="occured",
            field=models.DateField(auto_now_add=True, verbose_name="Occured"),
        ),
        migrations.AlterField(
            model_name="compliancetask",
            name="review",
            field=models.ManyToManyField(
                blank=True,
                help_text="list of reviews that contain this task",
                related_name="tasks",
                to="wbcompliance.reviewcompliancetask",
                verbose_name="Review",
            ),
        ),
        migrations.AlterField(
            model_name="compliancetaskinstance",
            name="review",
            field=models.ManyToManyField(
                blank=True,
                help_text="list of reviews that contain this task instance",
                related_name="task_instances",
                to="wbcompliance.reviewcompliancetask",
                verbose_name="Review",
            ),
        ),
        migrations.AlterField(
            model_name="compliancetaskinstance",
            name="summary_text",
            field=models.TextField(blank=True, null=True, verbose_name="Summary Text"),
        ),
        migrations.AlterField(
            model_name="complianceaction",
            name="deadline",
            field=models.DateField(blank=True, null=True, verbose_name="Deadline"),
        ),
        migrations.AddField(
            model_name="complianceform",
            name="compliance_type",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="wbcompliance.compliancetype",
                verbose_name="Type",
            ),
        ),
        migrations.AddField(
            model_name="reviewcompliancetask",
            name="type",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="wbcompliance.compliancetype",
                verbose_name="Type",
            ),
        ),
        migrations.RunSQL(
            sql="SET CONSTRAINTS ALL IMMEDIATE;",
        ),
        migrations.AlterField(
            model_name="complianceform",
            name="compliance_type",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT, to="wbcompliance.compliancetype", verbose_name="Type"
            ),
        ),
        migrations.AlterField(
            model_name="complianceaction",
            name="type",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="actions_of_type",
                to="wbcompliance.compliancetype",
                verbose_name="Type",
            ),
        ),
        migrations.AlterField(
            model_name="complianceevent",
            name="type",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="events_of_type",
                to="wbcompliance.compliancetype",
                verbose_name="Type",
            ),
        ),
        migrations.AlterField(
            model_name="compliancetask",
            name="type",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="tasks_of_type",
                to="wbcompliance.compliancetype",
                verbose_name="Type",
            ),
        ),
        migrations.AlterField(
            model_name="reviewcompliancetask",
            name="type",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="reviewtask_of_type",
                to="wbcompliance.compliancetype",
                verbose_name="Type",
            ),
        ),
        migrations.RunSQL(
            sql="SET CONSTRAINTS ALL DEFERRED;",
        ),
        migrations.RemoveIndex(
            model_name="ruletriggererrelationship",
            name="wbcomplianc_rule_id_c5fc0f_idx",
        ),
        migrations.RenameField(
            model_name="riskcheck",
            old_name="rule_triggerer_relationship",
            new_name="rule_checked_object_relationship",
        ),
        migrations.RenameField(
            model_name="rulebackend",
            old_name="allowed_triggerer_content_type",
            new_name="allowed_checked_object_content_type",
        ),
        migrations.RenameField(
            model_name="ruletriggererrelationship",
            old_name="triggerer_id",
            new_name="checked_object_id",
        ),
        migrations.RenameField(
            model_name="ruletriggererrelationship",
            old_name="triggerer_repr",
            new_name="checked_object_repr",
        ),
        migrations.RenameField(
            model_name="ruletriggererrelationship",
            old_name="triggerer_content_type",
            new_name="checked_object_content_type",
        ),
        migrations.AddField(
            model_name="riskcheck",
            name="trigger_content_type",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="triggered_checks",
                to="contenttypes.contenttype",
            ),
        ),
        migrations.AddField(
            model_name="riskcheck",
            name="trigger_id",
            field=models.PositiveIntegerField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name="ruletriggererrelationship",
            name="checked_object_content_type",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="risk_management_checked_objects",
                to="contenttypes.contenttype",
            ),
        ),
        migrations.AlterField(
            model_name="ruletriggererrelationship",
            name="rule",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="checked_object_relationships",
                to="wbcompliance.riskrule",
            ),
        ),
        migrations.AlterField(
            model_name="triggererincidentrelationship",
            name="incident",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="checked_object_relationships",
                to="wbcompliance.riskincident",
            ),
        ),
        migrations.AddIndex(
            model_name="ruletriggererrelationship",
            index=models.Index(
                fields=["rule", "checked_object_content_type", "checked_object_id"],
                name="wbcomplianc_rule_id_18dca9_idx",
            ),
        ),
        migrations.RenameModel(
            old_name="TriggererIncidentRelationship",
            new_name="CheckedObjectIncidentRelationship",
        ),
        migrations.RenameModel(
            old_name="RuleTriggererRelationship",
            new_name="RuleCheckedObjectRelationship",
        ),
        migrations.AlterModelOptions(
            name="checkedobjectincidentrelationship",
            options={
                "verbose_name": "Incident to Checked Object relationship",
                "verbose_name_plural": "Incident to Checked Object relationships",
            },
        ),
        migrations.AlterModelOptions(
            name="rulecheckedobjectrelationship",
            options={
                "verbose_name": "Checked Object to Rule relationship",
                "verbose_name_plural": "Checked Object to Rule relationships",
            },
        ),
        migrations.RenameIndex(
            model_name="checkedobjectincidentrelationship",
            new_name="wbcomplianc_inciden_f3db32_idx",
            old_name="wbcomplianc_inciden_e01fa0_idx",
        ),
        migrations.RenameIndex(
            model_name="rulecheckedobjectrelationship",
            new_name="wbcomplianc_rule_id_f0f369_idx",
            old_name="wbcomplianc_rule_id_18dca9_idx",
        ),
        migrations.AlterField(
            model_name="riskcheck",
            name="rule_checked_object_relationship",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="checks",
                to="wbcompliance.rulecheckedobjectrelationship",
                verbose_name="Rule-Checked Object Relationship",
            ),
        ),
        migrations.AlterField(
            model_name="riskcheck",
            name="rule_checked_object_relationship",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="checks",
                to="wbcompliance.rulecheckedobjectrelationship",
                verbose_name="Rule-Checked Object Relationship",
            ),
        ),
        migrations.RenameField(
            model_name="riskrule",
            old_name="is_passive",
            new_name="only_passive_check_allowed",
        ),
        migrations.AddField(
            model_name="riskcheck",
            name="status",
            field=models.CharField(
                choices=[
                    ("PENDING", "Pending"),
                    ("RUNNING", "Running"),
                    ("FAILED", "Failed"),
                    ("SUCCESS", "Success"),
                    ("WARNING", "Warning"),
                ],
                default="PENDING",
                max_length=32,
                verbose_name="Status",
            ),
        ),
        migrations.AlterField(
            model_name="riskrule",
            name="only_passive_check_allowed",
            field=models.BooleanField(
                default=True,
                help_text="If False, This rule can only be triggered passively",
                verbose_name="Passive Only",
            ),
        ),
        migrations.AddField(
            model_name="checkedobjectincidentrelationship",
            name="resolved_by",
            field=models.ForeignKey(
                blank=True,
                help_text="The person that resolved or ignored this incident",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="%(class)s_handled",
                to="directory.person",
                verbose_name="Handled by",
            ),
        ),
        migrations.AddField(
            model_name="complianceaction",
            name="changer",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="updated_actions",
                to="directory.person",
                verbose_name="Changer",
            ),
        ),
        migrations.AddField(
            model_name="complianceaction",
            name="creator",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="compliance_actions",
                to="directory.person",
                verbose_name="Creator",
            ),
        ),
        migrations.AddField(
            model_name="complianceevent",
            name="changer",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="updated_events",
                to="directory.person",
                verbose_name="Changer",
            ),
        ),
        migrations.AddField(
            model_name="complianceevent",
            name="creator",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="compliance_events",
                to="directory.person",
                verbose_name="Creator",
            ),
        ),
        migrations.AddField(
            model_name="complianceform",
            name="changer",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="directory.person",
                verbose_name="Changer",
            ),
        ),
        migrations.AddField(
            model_name="complianceform",
            name="creator",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="compliance_forms",
                to="directory.person",
                verbose_name="Creator",
            ),
        ),
        migrations.AddField(
            model_name="complianceformsignature",
            name="person",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="signed_compliance_forms",
                to="directory.person",
                verbose_name="Signer",
            ),
        ),
        migrations.AddField(
            model_name="reviewcompliancetask",
            name="changer",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="directory.person",
                verbose_name="Changer",
            ),
        ),
        migrations.AddField(
            model_name="reviewcompliancetask",
            name="creator",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="author_review_compliane_tasks",
                to="directory.person",
                verbose_name="Creator",
            ),
        ),
        migrations.AddField(
            model_name="riskincident",
            name="resolved_by",
            field=models.ForeignKey(
                blank=True,
                help_text="The person that resolved or ignored this incident",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="%(class)s_handled",
                to="directory.person",
                verbose_name="Handled by",
            ),
        ),
        migrations.AddField(
            model_name="rulethreshold",
            name="notifiable_users",
            field=models.ManyToManyField(
                blank=True,
                help_text="Notified Persons for this rule and severity",
                related_name="notified_rule_thresholds",
                to="directory.person",
                verbose_name="Notifiable Persons",
            ),
        ),
        migrations.AlterField(
            model_name="checkedobjectincidentrelationship",
            name="severity",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="%(class)s",
                to="wbcompliance.riskincidenttype",
                verbose_name="Severity",
            ),
        ),
        migrations.AlterField(
            model_name="riskincident",
            name="severity",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="%(class)s",
                to="wbcompliance.riskincidenttype",
                verbose_name="Severity",
            ),
        ),
    ]
