# Generated by Django 5.2.9 on 2026-02-05

import django.db.models.deletion
import netbox.models.deletion
import taggit.managers
import utilities.json
from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        ("extras", "0134_owner"),
        ("netbox_rir_manager", "0005_rircontact_synced_by_rirnetwork_synced_by_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="RIRTicket",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
                ("created", models.DateTimeField(auto_now_add=True, null=True)),
                ("last_updated", models.DateTimeField(auto_now=True, null=True)),
                (
                    "custom_field_data",
                    models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder),
                ),
                ("ticket_number", models.CharField(max_length=50, unique=True)),
                ("ticket_type", models.CharField(max_length=50)),
                ("status", models.CharField(max_length=30)),
                ("resolution", models.CharField(blank=True, default="", max_length=30)),
                ("created_date", models.DateTimeField()),
                ("resolved_date", models.DateTimeField(blank=True, null=True)),
                ("raw_data", models.JSONField(blank=True, default=dict)),
                (
                    "rir_config",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="tickets",
                        to="netbox_rir_manager.rirconfig",
                    ),
                ),
                (
                    "network",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="tickets",
                        to="netbox_rir_manager.rirnetwork",
                    ),
                ),
                (
                    "submitted_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="tickets",
                        to="netbox_rir_manager.riruserkey",
                    ),
                ),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
            ],
            options={
                "ordering": ["-created_date"],
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
    ]
