# Generated by Django 5.1.15 on 2026-02-09 03:45

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


class Migration(migrations.Migration):

    dependencies = [
        ("access", "0018_remove_contactticket_model_and_more"),
        ("core", "0029_remove_manufacturernotes_model_and_more"),
    ]

    operations = [
        migrations.RemoveField(
            model_name="modelhistory",
            name="content_type",
        ),
        migrations.RemoveField(
            model_name="modelhistory",
            name="organization",
        ),
        migrations.RemoveField(
            model_name="modelhistory",
            name="user",
        ),
        migrations.RemoveField(
            model_name="ticketcommentcategoryhistory",
            name="modelhistory_ptr",
        ),
        migrations.RemoveField(
            model_name="ticketcategoryhistory",
            name="modelhistory_ptr",
        ),
        migrations.RemoveField(
            model_name="modelnotes",
            name="content_type",
        ),
        migrations.RemoveField(
            model_name="modelnotes",
            name="created_by",
        ),
        migrations.RemoveField(
            model_name="modelnotes",
            name="modified_by",
        ),
        migrations.RemoveField(
            model_name="modelnotes",
            name="organization",
        ),
        migrations.RemoveField(
            model_name="ticketcommentcategorynotes",
            name="modelnotes_ptr",
        ),
        migrations.RemoveField(
            model_name="ticketcategorynotes",
            name="modelnotes_ptr",
        ),
        migrations.RemoveField(
            model_name="notes",
            name="config_group",
        ),
        migrations.RemoveField(
            model_name="notes",
            name="device",
        ),
        migrations.RemoveField(
            model_name="notes",
            name="operatingsystem",
        ),
        migrations.RemoveField(
            model_name="notes",
            name="organization",
        ),
        migrations.RemoveField(
            model_name="notes",
            name="service",
        ),
        migrations.RemoveField(
            model_name="notes",
            name="software",
        ),
        migrations.RemoveField(
            model_name="notes",
            name="usercreated",
        ),
        migrations.RemoveField(
            model_name="notes",
            name="usermodified",
        ),
        migrations.RemoveField(
            model_name="ticketcategoryhistory",
            name="model",
        ),
        migrations.RemoveField(
            model_name="ticketcategorynotes",
            name="model",
        ),
        migrations.RemoveField(
            model_name="ticketcommentcategoryhistory",
            name="model",
        ),
        migrations.RemoveField(
            model_name="ticketcommentcategorynotes",
            name="model",
        ),
        migrations.AlterModelOptions(
            name="ticketcommentbase",
            options={
                "ordering": ["id"],
                "permissions": [
                    ("import_ticketcommentbase", "Can import ticket comment."),
                    ("purge_ticketcommentbase", "Can purge ticket comment."),
                ],
                "verbose_name": "Ticket Comment",
                "verbose_name_plural": "Ticket Comments",
            },
        ),
        migrations.AlterModelOptions(
            name="ticketcommentsolution",
            options={
                "ordering": ["id"],
                "permissions": [
                    (
                        "import_ticketcommentsolution",
                        "Can import ticket solution comment.",
                    ),
                    (
                        "purge_ticketcommentsolution",
                        "Can purge ticket solution comment.",
                    ),
                ],
                "verbose_name": "Ticket Comment Solution",
                "verbose_name_plural": "Ticket Comment Solutions",
            },
        ),
        migrations.AlterField(
            model_name="ticketbase",
            name="assigned_to",
            field=models.ManyToManyField(
                blank=True,
                help_text="Users / Groups assigned to the ticket",
                related_name="ticket_assigned",
                to="access.entity",
                verbose_name="Assignees",
            ),
        ),
        migrations.AlterField(
            model_name="ticketbase",
            name="subscribed_to",
            field=models.ManyToManyField(
                blank=True,
                help_text="Users / Groups subscribed to the ticket",
                related_name="ticket_subscription",
                to="access.entity",
                verbose_name="Subscribers",
            ),
        ),
        migrations.AlterField(
            model_name="ticketcommentbase",
            name="ticket",
            field=models.ForeignKey(
                help_text="Ticket this comment belongs to",
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="core.ticketbase",
                verbose_name="Ticket",
            ),
        ),
        migrations.CreateModel(
            name="TicketCommentTask",
            fields=[
                (
                    "ticketcommentbase_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.ticketcommentbase",
                    ),
                ),
                (
                    "status",
                    models.IntegerField(
                        choices=[(1, "To Do"), (2, "Done")],
                        default=1,
                        help_text="Status of task",
                        verbose_name="Status",
                    ),
                ),
                (
                    "planned_start_date",
                    models.DateTimeField(
                        blank=True,
                        help_text="Planned start date.",
                        null=True,
                        verbose_name="Planned Start Date",
                    ),
                ),
                (
                    "planned_finish_date",
                    models.DateTimeField(
                        blank=True,
                        help_text="Planned finish date",
                        null=True,
                        verbose_name="Planned Finish Date",
                    ),
                ),
                (
                    "real_start_date",
                    models.DateTimeField(
                        blank=True,
                        help_text="Real start date",
                        null=True,
                        verbose_name="Real Start Date",
                    ),
                ),
                (
                    "real_finish_date",
                    models.DateTimeField(
                        blank=True,
                        help_text="Real finish date",
                        null=True,
                        verbose_name="Real Finish Date",
                    ),
                ),
                (
                    "is_deleted",
                    models.BooleanField(
                        blank=True,
                        default=False,
                        help_text="Is the comment deleted? And ready to be purged",
                        verbose_name="Deleted",
                    ),
                ),
                (
                    "assignee",
                    models.ForeignKey(
                        blank=True,
                        default=None,
                        help_text="whom is responsible for the completion of comment",
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="access.entity",
                        verbose_name="Assignee",
                    ),
                ),
            ],
            options={
                "verbose_name": "Ticket Comment Task",
                "verbose_name_plural": "Ticket Comment Task",
                "ordering": ["id"],
                "permissions": [
                    ("import_ticketcommenttask", "Can import ticket task comment."),
                    ("purge_ticketcommenttask", "Can purge ticket task comment."),
                ],
                "sub_model_type": "task",
            },
            bases=("core.ticketcommentbase",),
        ),
        migrations.CreateModel(
            name="TicketDependency",
            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",
                    ),
                ),
                (
                    "how_related",
                    models.IntegerField(
                        choices=[(1, "Related"), (2, "Blocks"), (3, "Blocked By")],
                        help_text="How is the ticket related",
                        verbose_name="How Related",
                    ),
                ),
                (
                    "dependent_ticket",
                    models.ForeignKey(
                        help_text="The Related Ticket",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="dependent_ticket",
                        to="core.ticketbase",
                        verbose_name="Related Ticket",
                    ),
                ),
                (
                    "organization",
                    models.ForeignKey(
                        help_text="Tenant this belongs to",
                        null=True,
                        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="This Ticket",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ticket",
                        to="core.ticketbase",
                        verbose_name="Ticket",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="Who added the dependency",
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="access.entity",
                        verbose_name="User",
                    ),
                ),
            ],
            options={
                "verbose_name": "Ticket Dependency",
                "verbose_name_plural": "Ticket Dependencies",
                "ordering": ["id"],
            },
        ),
    ]
