# Generated by Django 5.1.10 on 2025-08-15 03:21

import access.fields
import access.models.tenancy_abstract
import core.models.centurion
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("access", "0010_company_alter_entity_entity_type_alter_person_dob_and_more"),
        ("assistance", "0006_alter_knowledgebase_organization_and_more"),
        ("contenttypes", "0002_remove_content_type_name"),
        ("core", "0023_ticketcommentaction_alter_manufacturer_organization_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="CenturionAudit",
            fields=[
                (
                    "id",
                    models.AutoField(
                        help_text="ID of the item",
                        primary_key=True,
                        serialize=False,
                        unique=True,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created",
                    access.fields.AutoCreatedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        help_text="Date and time of creation",
                        verbose_name="Created",
                    ),
                ),
                (
                    "before",
                    models.JSONField(
                        blank=True,
                        help_text="Value before Change",
                        null=True,
                        validators=[
                            core.models.centurion.CenturionModel.validate_field_not_none
                        ],
                        verbose_name="Before",
                    ),
                ),
                (
                    "after",
                    models.JSONField(
                        blank=True,
                        help_text="Value Change to",
                        null=True,
                        validators=[
                            core.models.centurion.CenturionModel.validate_field_not_none
                        ],
                        verbose_name="After",
                    ),
                ),
                (
                    "action",
                    models.IntegerField(
                        choices=[(1, "Create"), (2, "Update"), (3, "Delete")],
                        help_text="History action performed",
                        null=True,
                        validators=[
                            core.models.centurion.CenturionModel.validate_field_not_none
                        ],
                        verbose_name="Action",
                    ),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        blank=True,
                        help_text="Model this history is for",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.contenttype",
                        validators=[
                            core.models.centurion.CenturionModel.validate_field_not_none
                        ],
                        verbose_name="Content Model",
                    ),
                ),
                (
                    "organization",
                    models.ForeignKey(
                        help_text="Tenant this belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="access.tenant",
                        validators=[
                            access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
                        ],
                        verbose_name="Tenant",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="User whom performed the action",
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to=settings.AUTH_USER_MODEL,
                        validators=[
                            core.models.centurion.CenturionModel.validate_field_not_none
                        ],
                        verbose_name="User",
                    ),
                ),
            ],
            options={
                "verbose_name": "Model History",
                "verbose_name_plural": "Model Histories",
                "db_table": "core_audithistory",
                "ordering": ["-created"],
            },
        ),
        migrations.CreateModel(
            name="CenturionModelNote",
            fields=[
                (
                    "id",
                    models.AutoField(
                        help_text="ID of the item",
                        primary_key=True,
                        serialize=False,
                        unique=True,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created",
                    access.fields.AutoCreatedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        help_text="Date and time of creation",
                        verbose_name="Created",
                    ),
                ),
                (
                    "body",
                    models.TextField(
                        help_text="The tid bit of information you wish to add",
                        verbose_name="Note",
                    ),
                ),
                (
                    "modified",
                    access.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        help_text="Date and time of last modification",
                        verbose_name="Modified",
                    ),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        blank=True,
                        help_text="Model this note is for",
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.contenttype",
                        verbose_name="Content Model",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        help_text="User whom added the Note",
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="Created By",
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        help_text="User whom modified the note",
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="Edited By",
                    ),
                ),
                (
                    "organization",
                    models.ForeignKey(
                        help_text="Tenant this belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="access.tenant",
                        validators=[
                            access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
                        ],
                        verbose_name="Tenant",
                    ),
                ),
            ],
            options={
                "verbose_name": "Centurion Model Note",
                "verbose_name_plural": "Centurion Model Notes",
                "ordering": ["-created"],
            },
        ),
        migrations.RemoveField(
            model_name="manufacturer",
            name="is_global",
        ),
        migrations.RemoveField(
            model_name="manufacturer",
            name="slug",
        ),
        migrations.RemoveField(
            model_name="ticketcategory",
            name="is_global",
        ),
        migrations.RemoveField(
            model_name="ticketcommentcategory",
            name="is_global",
        ),
        migrations.AlterField(
            model_name="manufacturer",
            name="model_notes",
            field=models.TextField(
                blank=True,
                help_text="Tid bits of information",
                null=True,
                verbose_name="Notes",
            ),
        ),
        migrations.AlterField(
            model_name="manufacturer",
            name="organization",
            field=models.ForeignKey(
                help_text="Tenant this belongs to",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="access.tenant",
                validators=[
                    access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
                ],
                verbose_name="Tenant",
            ),
        ),
        migrations.AlterField(
            model_name="ticketbase",
            name="external_ref",
            field=models.IntegerField(
                blank=True,
                help_text="External System reference",
                null=True,
                verbose_name="Reference Number",
            ),
        ),
        migrations.AlterField(
            model_name="ticketbase",
            name="external_system",
            field=models.IntegerField(
                blank=True,
                choices=[
                    (1, "Github"),
                    (2, "Gitlab"),
                    (9999, "Custom #1 (Imported)"),
                    (9998, "Custom #2 (Imported)"),
                    (9997, "Custom #3 (Imported)"),
                    (9996, "Custom #4 (Imported)"),
                    (9995, "Custom #5 (Imported)"),
                    (9994, "Custom #6 (Imported)"),
                    (9993, "Custom #7 (Imported)"),
                    (9992, "Custom #8 (Imported)"),
                    (9991, "Custom #9 (Imported)"),
                ],
                help_text="External system this item derives",
                null=True,
                verbose_name="External System",
            ),
        ),
        migrations.AlterField(
            model_name="ticketbase",
            name="id",
            field=models.AutoField(
                help_text="ID of the item",
                primary_key=True,
                serialize=False,
                unique=True,
                verbose_name="ID",
            ),
        ),
        migrations.AlterField(
            model_name="ticketbase",
            name="organization",
            field=models.ForeignKey(
                help_text="Tenant this belongs to",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="access.tenant",
                validators=[
                    access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
                ],
                verbose_name="Tenant",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcategory",
            name="id",
            field=models.AutoField(
                help_text="ID of the item",
                primary_key=True,
                serialize=False,
                unique=True,
                verbose_name="ID",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcategory",
            name="model_notes",
            field=models.TextField(
                blank=True,
                help_text="Tid bits of information",
                null=True,
                verbose_name="Notes",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcategory",
            name="organization",
            field=models.ForeignKey(
                help_text="Tenant this belongs to",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="access.tenant",
                validators=[
                    access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
                ],
                verbose_name="Tenant",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcategory",
            name="parent",
            field=models.ForeignKey(
                blank=True,
                help_text="The Parent Category",
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="core.ticketcategory",
                verbose_name="Parent Category",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcategory",
            name="runbook",
            field=models.ForeignKey(
                blank=True,
                help_text="The runbook for this category",
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="assistance.knowledgebase",
                verbose_name="Runbook",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcommentbase",
            name="id",
            field=models.AutoField(
                help_text="ID of the item",
                primary_key=True,
                serialize=False,
                unique=True,
                verbose_name="ID",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcommentbase",
            name="organization",
            field=models.ForeignKey(
                help_text="Tenant this belongs to",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="access.tenant",
                validators=[
                    access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
                ],
                verbose_name="Tenant",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcommentcategory",
            name="id",
            field=models.AutoField(
                help_text="ID of the item",
                primary_key=True,
                serialize=False,
                unique=True,
                verbose_name="ID",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcommentcategory",
            name="model_notes",
            field=models.TextField(
                blank=True,
                help_text="Tid bits of information",
                null=True,
                verbose_name="Notes",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcommentcategory",
            name="organization",
            field=models.ForeignKey(
                help_text="Tenant this belongs to",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="access.tenant",
                validators=[
                    access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
                ],
                verbose_name="Tenant",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcommentcategory",
            name="parent",
            field=models.ForeignKey(
                blank=True,
                help_text="The Parent Category",
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="core.ticketcommentcategory",
                verbose_name="Parent Category",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcommentcategory",
            name="runbook",
            field=models.ForeignKey(
                blank=True,
                help_text="The runbook for this category",
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="assistance.knowledgebase",
                verbose_name="Runbook",
            ),
        ),
        migrations.CreateModel(
            name="ManufacturerAuditHistory",
            fields=[
                (
                    "centurionaudit_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.centurionaudit",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model this history belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="audit_history",
                        to="core.manufacturer",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "Manufacturer History",
                "verbose_name_plural": "Manufacturer Histories",
                "db_table": "core_manufacturer_audithistory",
                "managed": True,
            },
            bases=("core.centurionaudit",),
        ),
        migrations.CreateModel(
            name="TicketCategoryAuditHistory",
            fields=[
                (
                    "centurionaudit_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.centurionaudit",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model this history belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="audit_history",
                        to="core.ticketcategory",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "Ticket Category History",
                "verbose_name_plural": "Ticket Category Histories",
                "db_table": "core_ticketcategory_audithistory",
                "managed": True,
            },
            bases=("core.centurionaudit",),
        ),
        migrations.CreateModel(
            name="TicketCommentCategoryAuditHistory",
            fields=[
                (
                    "centurionaudit_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.centurionaudit",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model this history belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="audit_history",
                        to="core.ticketcommentcategory",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "Ticket Comment Category History",
                "verbose_name_plural": "Ticket Comment Category Histories",
                "db_table": "core_ticketcommentcategory_audithistory",
                "managed": True,
            },
            bases=("core.centurionaudit",),
        ),
        migrations.CreateModel(
            name="ManufacturerCenturionModelNote",
            fields=[
                (
                    "centurionmodelnote_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.centurionmodelnote",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model this note belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="core.manufacturer",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "Manufacturer Note",
                "verbose_name_plural": "Manufacturer Notes",
                "db_table": "core_manufacturer_centurionmodelnote",
                "managed": True,
            },
            bases=("core.centurionmodelnote",),
        ),
        migrations.CreateModel(
            name="TicketCategoryCenturionModelNote",
            fields=[
                (
                    "centurionmodelnote_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.centurionmodelnote",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model this note belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="core.ticketcategory",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "Ticket Category Note",
                "verbose_name_plural": "Ticket Category Notes",
                "db_table": "core_ticketcategory_centurionmodelnote",
                "managed": True,
            },
            bases=("core.centurionmodelnote",),
        ),
        migrations.CreateModel(
            name="TicketCommentCategoryCenturionModelNote",
            fields=[
                (
                    "centurionmodelnote_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.centurionmodelnote",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model this note belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="core.ticketcommentcategory",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "Ticket Comment Category Note",
                "verbose_name_plural": "Ticket Comment Category Notes",
                "db_table": "core_ticketcommentcategory_centurionmodelnote",
                "managed": True,
            },
            bases=("core.centurionmodelnote",),
        ),
        migrations.DeleteModel(
            name="History",
        ),
    ]
