# Generated by Django 5.1.7 on 2025-06-24 08:49

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("circuits", "0051_virtualcircuit_group_assignment"),
        ("dcim", "0207_remove_redundant_indexes"),
        ("extras", "0128_tableconfig"),
        ("tenancy", "0020_remove_contactgroupmembership"),
        ("virtualization", "0048_populate_mac_addresses"),
    ]

    operations = [
        migrations.CreateModel(
            name="PhoneNumberRange",
            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,
                    ),
                ),
                ("country_code", models.CharField(default="+32", max_length=50)),
                ("start_number", models.PositiveIntegerField()),
                ("end_number", models.PositiveIntegerField()),
                ("size", models.PositiveIntegerField(editable=False)),
                ("status", models.CharField(default="active", max_length=50)),
                ("description", models.CharField(blank=True, max_length=255)),
                ("type", models.CharField(default="fixed", max_length=50)),
                (
                    "region",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="phonenumberranges_region",
                        to="dcim.region",
                    ),
                ),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
                (
                    "tenant",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="phonenumberrange",
                        to="tenancy.tenant",
                    ),
                ),
                (
                    "voice_cicruit",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="phonenumberranges_circuit",
                        to="circuits.circuit",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Sim",
            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,
                    ),
                ),
                ("sim_id", models.PositiveBigIntegerField(unique=True)),
                ("iccid", models.DecimalField(decimal_places=0, max_digits=30)),
                ("msisdn", models.PositiveBigIntegerField()),
                ("pin", models.PositiveIntegerField(blank=True, null=True)),
                ("puk", models.PositiveIntegerField(blank=True, null=True)),
                (
                    "numeric_value",
                    models.DecimalField(decimal_places=2, default=0, max_digits=10),
                ),
                ("description", models.CharField(blank=True, max_length=255)),
                (
                    "provider",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="circuitsim",
                        to="circuits.provider",
                    ),
                ),
                (
                    "provider_account",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="circuitssim",
                        to="circuits.provideraccount",
                    ),
                ),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
                (
                    "tenant",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="sim",
                        to="tenancy.tenant",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="PhoneNumber",
            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,
                    ),
                ),
                ("number", models.PositiveIntegerField()),
                ("country_code", models.CharField(default="+32", max_length=50)),
                ("incoming_dailpeer", models.CharField(blank=True, max_length=32)),
                ("outgoining_dailpeer", models.CharField(blank=True, max_length=32)),
                ("number_routing_ref", models.CharField(blank=True, max_length=255)),
                ("description", models.CharField(blank=True, max_length=255)),
                ("status", models.CharField(default="active", max_length=50)),
                ("type", models.CharField(default="fixed", max_length=50)),
                (
                    "primary_device",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="phonenumbers_device",
                        to="dcim.device",
                    ),
                ),
                (
                    "primary_vm",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="phonenumbers_vm",
                        to="virtualization.virtualmachine",
                    ),
                ),
                (
                    "region",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="phonenumbers_region",
                        to="dcim.region",
                    ),
                ),
                (
                    "secondary_device",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="phonenumbers_device_sec",
                        to="dcim.device",
                    ),
                ),
                (
                    "secondary_vm",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="phonenumbers_vm_sec",
                        to="virtualization.virtualmachine",
                    ),
                ),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
                (
                    "tenant",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="phonenumbers",
                        to="tenancy.tenant",
                    ),
                ),
                (
                    "voice_cicruit",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="phonenumbers_circuit",
                        to="circuits.circuit",
                    ),
                ),
                (
                    "sim",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="sim_number",
                        to="phone_management_plugin.sim",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="SimAdmin",
            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,
                    ),
                ),
                ("ki", models.CharField(blank=True, max_length=50, null=True)),
                ("opc", models.CharField(blank=True, max_length=50, null=True)),
                ("admin_key", models.CharField(blank=True, max_length=50, null=True)),
                ("mapped_imei", models.PositiveBigIntegerField(blank=True, null=True)),
                (
                    "sim",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="sim_admin",
                        to="phone_management_plugin.sim",
                    ),
                ),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
