# Generated by Django 5.1.13 on 2025-10-09 04:52

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


class Migration(migrations.Migration):

    dependencies = [
        ("access", "0015_remove_teamnotes_model_and_more"),
        ("contenttypes", "0002_remove_content_type_name"),
        ("core", "0025_alter_manufactureraudithistory_options_and_more"),
    ]

    operations = [
        migrations.AlterModelOptions(
            name="ticketbase",
            options={
                "ordering": ["id"],
                "permissions": [
                    ("import_ticketbase", "Can import a ticket base"),
                    ("purge_ticketbase", "Can purge a ticket base"),
                    ("triage_ticketbase", "Can triage a ticket base"),
                ],
                "verbose_name": "Ticket",
                "verbose_name_plural": "Tickets",
            },
        ),
        migrations.AlterField(
            model_name="ticketcommentbase",
            name="parent",
            field=models.ForeignKey(
                blank=True,
                help_text="Parent ID for creating discussion threads",
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                related_name="threads",
                to="core.ticketcommentbase",
                verbose_name="Parent Comment",
            ),
        ),
        migrations.CreateModel(
            name="ModelTicket",
            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",
                    ),
                ),
                (
                    "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 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",
                    ),
                ),
                (
                    "ticket",
                    models.ForeignKey(
                        help_text="Ticket object is linked to",
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="linked_models",
                        to="core.ticketbase",
                        verbose_name="Ticket",
                    ),
                ),
            ],
            options={
                "verbose_name": "Ticket Linked Model",
                "verbose_name_plural": "Ticket Linked Models",
                "ordering": ["created"],
            },
        ),
        migrations.CreateModel(
            name="ManufacturerTicket",
            fields=[
                (
                    "modelticket_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.modelticket",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model the ticket is for.",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="core.manufacturer",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "Manufacturer Ticket",
                "verbose_name_plural": "Manufacturer Tickets",
                "db_table": "core_manufacturer_ticket",
                "managed": True,
            },
            bases=("core.modelticket",),
        ),
        migrations.CreateModel(
            name="TicketCategoryTicket",
            fields=[
                (
                    "modelticket_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.modelticket",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model the ticket is for.",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="core.ticketcategory",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "Ticket Category Ticket",
                "verbose_name_plural": "Ticket Category Tickets",
                "db_table": "core_ticketcategory_ticket",
                "managed": True,
            },
            bases=("core.modelticket",),
        ),
        migrations.CreateModel(
            name="TicketCommentCategoryTicket",
            fields=[
                (
                    "modelticket_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.modelticket",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model the ticket is for.",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="core.ticketcommentcategory",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "Ticket Comment Category Ticket",
                "verbose_name_plural": "Ticket Comment Category Tickets",
                "db_table": "core_ticketcommentcategory_ticket",
                "managed": True,
            },
            bases=("core.modelticket",),
        ),
    ]
