# Generated by Django 5.2.11 on 2026-03-11 14:36

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("dcim", "0226_add_mptt_tree_indexes"),
        ("extras", "0134_owner"),
    ]

    operations = [
        migrations.CreateModel(
            name="FiberCable",
            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),
                ),
                ("serial_number", models.CharField(blank=True, max_length=100)),
                ("install_date", models.DateField(blank=True, null=True)),
                ("notes", models.TextField(blank=True)),
                (
                    "cable",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE, related_name="fiber_attributes", to="dcim.cable"
                    ),
                ),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
            ],
            options={
                "verbose_name": "fiber cable",
                "verbose_name_plural": "fiber cables",
                "ordering": ("cable",),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name="BufferTube",
            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),
                ),
                ("name", models.CharField(max_length=64)),
                ("position", models.PositiveIntegerField()),
                ("color", utilities.fields.ColorField(blank=True, max_length=6)),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
                (
                    "fiber_cable",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="buffer_tubes",
                        to="netbox_fms.fibercable",
                    ),
                ),
            ],
            options={
                "verbose_name": "buffer tube",
                "verbose_name_plural": "buffer tubes",
                "ordering": ("fiber_cable", "position"),
                "unique_together": {("fiber_cable", "name")},
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name="FiberCableType",
            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),
                ),
                ("model", models.CharField(max_length=100)),
                ("part_number", models.CharField(blank=True, max_length=100)),
                ("construction", models.CharField(max_length=50)),
                ("fiber_type", models.CharField(max_length=50)),
                ("strand_count", models.PositiveIntegerField()),
                ("sheath_material", models.CharField(blank=True, max_length=50)),
                ("jacket_color", utilities.fields.ColorField(blank=True, max_length=6)),
                ("is_armored", models.BooleanField(default=False)),
                ("armor_type", models.CharField(blank=True, max_length=50)),
                ("deployment", models.CharField(blank=True, max_length=50)),
                ("fire_rating", models.CharField(blank=True, max_length=50)),
                ("notes", models.TextField(blank=True)),
                (
                    "manufacturer",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="fiber_cable_types",
                        to="dcim.manufacturer",
                    ),
                ),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
            ],
            options={
                "verbose_name": "fiber cable type",
                "verbose_name_plural": "fiber cable types",
                "ordering": ("manufacturer", "model"),
                "unique_together": {("manufacturer", "model")},
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.AddField(
            model_name="fibercable",
            name="fiber_cable_type",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT, related_name="instances", to="netbox_fms.fibercabletype"
            ),
        ),
        migrations.CreateModel(
            name="BufferTubeTemplate",
            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),
                ),
                ("name", models.CharField(max_length=64)),
                ("position", models.PositiveIntegerField()),
                ("color", utilities.fields.ColorField(blank=True, max_length=6)),
                ("fiber_count", models.PositiveIntegerField(blank=True, null=True)),
                ("description", models.CharField(blank=True, max_length=200)),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
                (
                    "fiber_cable_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="buffer_tube_templates",
                        to="netbox_fms.fibercabletype",
                    ),
                ),
            ],
            options={
                "verbose_name": "buffer tube template",
                "verbose_name_plural": "buffer tube templates",
                "ordering": ("fiber_cable_type", "position"),
                "unique_together": {("fiber_cable_type", "name")},
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name="FiberPathLoss",
            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),
                ),
                ("measured_loss_db", models.DecimalField(blank=True, decimal_places=3, max_digits=6, null=True)),
                ("calculated_loss_db", models.DecimalField(blank=True, decimal_places=3, max_digits=6, null=True)),
                ("wavelength_nm", models.PositiveIntegerField()),
                ("test_date", models.DateField(blank=True, null=True)),
                ("otdr_file", models.FileField(blank=True, null=True, upload_to="otdr/")),
                ("notes", models.TextField(blank=True)),
                (
                    "cable",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="fiber_path_losses", to="dcim.cable"
                    ),
                ),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
            ],
            options={
                "verbose_name": "fiber path loss",
                "verbose_name_plural": "fiber path losses",
                "ordering": ("cable", "wavelength_nm"),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name="Ribbon",
            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),
                ),
                ("name", models.CharField(max_length=64)),
                ("position", models.PositiveIntegerField()),
                ("color", utilities.fields.ColorField(blank=True, max_length=6)),
                (
                    "buffer_tube",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ribbons",
                        to="netbox_fms.buffertube",
                    ),
                ),
                (
                    "fiber_cable",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="ribbons", to="netbox_fms.fibercable"
                    ),
                ),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
            ],
            options={
                "verbose_name": "ribbon",
                "verbose_name_plural": "ribbons",
                "ordering": ("fiber_cable", "position"),
                "unique_together": {("fiber_cable", "name")},
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name="SplicePlan",
            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),
                ),
                ("name", models.CharField(max_length=100)),
                ("description", models.TextField(blank=True)),
                ("mode", models.CharField(max_length=50)),
                ("status", models.CharField(default="draft", max_length=50)),
                (
                    "closure",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="splice_plans", to="dcim.device"
                    ),
                ),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
                (
                    "tray",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="splice_plans",
                        to="dcim.module",
                    ),
                ),
            ],
            options={
                "verbose_name": "splice plan",
                "verbose_name_plural": "splice plans",
                "ordering": ("closure", "name"),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name="SplicePlanEntry",
            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),
                ),
                ("mode_override", models.CharField(blank=True, max_length=50)),
                (
                    "cable",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="splice_plan_entries",
                        to="dcim.cable",
                    ),
                ),
                (
                    "fiber_a",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="splice_entries_a",
                        to="dcim.frontport",
                    ),
                ),
                (
                    "fiber_b",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="splice_entries_b",
                        to="dcim.frontport",
                    ),
                ),
                (
                    "plan",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="entries", to="netbox_fms.spliceplan"
                    ),
                ),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
            ],
            options={
                "verbose_name": "splice plan entry",
                "verbose_name_plural": "splice plan entries",
                "ordering": ("plan", "pk"),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name="CableElement",
            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),
                ),
                ("name", models.CharField(max_length=64)),
                ("element_type", models.CharField(max_length=50)),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
                (
                    "fiber_cable",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="cable_elements",
                        to="netbox_fms.fibercable",
                    ),
                ),
            ],
            options={
                "verbose_name": "cable element",
                "verbose_name_plural": "cable elements",
                "ordering": ("fiber_cable", "name"),
                "unique_together": {("fiber_cable", "name")},
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name="CableElementTemplate",
            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),
                ),
                ("name", models.CharField(max_length=64)),
                ("element_type", models.CharField(max_length=50)),
                ("description", models.CharField(blank=True, max_length=200)),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
                (
                    "fiber_cable_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="cable_element_templates",
                        to="netbox_fms.fibercabletype",
                    ),
                ),
            ],
            options={
                "verbose_name": "cable element template",
                "verbose_name_plural": "cable element templates",
                "ordering": ("fiber_cable_type", "name"),
                "unique_together": {("fiber_cable_type", "name")},
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name="FiberStrand",
            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),
                ),
                ("name", models.CharField(max_length=64)),
                ("position", models.PositiveIntegerField()),
                ("color", utilities.fields.ColorField(blank=True, max_length=6)),
                (
                    "buffer_tube",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="fiber_strands",
                        to="netbox_fms.buffertube",
                    ),
                ),
                (
                    "fiber_cable",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="fiber_strands",
                        to="netbox_fms.fibercable",
                    ),
                ),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
                (
                    "ribbon",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="fiber_strands",
                        to="netbox_fms.ribbon",
                    ),
                ),
            ],
            options={
                "verbose_name": "fiber strand",
                "verbose_name_plural": "fiber strands",
                "ordering": ("fiber_cable", "position"),
                "unique_together": {("fiber_cable", "position")},
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name="RibbonTemplate",
            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),
                ),
                ("name", models.CharField(max_length=64)),
                ("position", models.PositiveIntegerField()),
                ("color", utilities.fields.ColorField(blank=True, max_length=6)),
                ("fiber_count", models.PositiveIntegerField()),
                ("description", models.CharField(blank=True, max_length=200)),
                (
                    "buffer_tube_template",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ribbon_templates",
                        to="netbox_fms.buffertubetemplate",
                    ),
                ),
                (
                    "fiber_cable_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ribbon_templates",
                        to="netbox_fms.fibercabletype",
                    ),
                ),
                ("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
            ],
            options={
                "verbose_name": "ribbon template",
                "verbose_name_plural": "ribbon templates",
                "ordering": ("fiber_cable_type", "buffer_tube_template", "position"),
                "unique_together": {("fiber_cable_type", "buffer_tube_template", "name")},
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
    ]
