# Generated by Django 4.2.8 on 2024-05-02 10:07

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("tenancy", "0014_contactassignment_ordering"),
        ("extras", "0106_bookmark_user_cascade_deletion"),
        ("dcim", "0185_gfk_indexes"),
    ]

    operations = [
        migrations.CreateModel(
            name="Segment",
            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=255)),
                (
                    "network_label",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                ("install_date", models.DateField(blank=True, null=True)),
                ("termination_date", models.DateField(blank=True, null=True)),
                (
                    "supplier_segment_id",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "supplier_segment_name",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "supplier_segment_contract",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                ("note_a", models.TextField(blank=True, null=True)),
                ("note_b", models.TextField(blank=True, null=True)),
                ("imported_data", models.JSONField(blank=True, null=True)),
                (
                    "device_a",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to="dcim.device",
                    ),
                ),
                (
                    "device_b",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to="dcim.device",
                    ),
                ),
                (
                    "location_a",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="dcim.location",
                    ),
                ),
                (
                    "location_b",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="dcim.location",
                    ),
                ),
                (
                    "port_a",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to="dcim.interface",
                    ),
                ),
                (
                    "port_b",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to="dcim.interface",
                    ),
                ),
                (
                    "site_a",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="dcim.site",
                    ),
                ),
                (
                    "site_b",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="dcim.site",
                    ),
                ),
                (
                    "supplier",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="tenancy.tenant",
                    ),
                ),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
            ],
            options={
                "ordering": ("name",),
            },
        ),
    ]
