# Generated by Django 4.1.9 on 2023-09-19 22:25

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("dcim", "0171_cabletermination_change_logging"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("extras", "0092_delete_jobresult"),
    ]

    operations = [
        migrations.CreateModel(
            name="Sensor",
            fields=[
                ("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,
                    ),
                ),
                ("id", models.AutoField(primary_key=True, serialize=False)),
                ("name", models.CharField(blank=True, max_length=64)),
                ("customer_id", models.CharField(max_length=64)),
                ("serial", models.CharField(max_length=100, unique=True)),
                ("description", models.TextField(blank=True)),
                ("comments", models.TextField(blank=True)),
                ("icon", models.CharField(default="device_hub", max_length=20)),
            ],
            options={
                "ordering": ("name",),
            },
        ),
        migrations.CreateModel(
            name="SensorType",
            fields=[
                ("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,
                    ),
                ),
                ("id", models.AutoField(primary_key=True, serialize=False)),
                ("name", models.CharField(max_length=100, unique=True)),
                ("comments", models.TextField(blank=True)),
                ("icon", models.CharField(default="device_hub", max_length=20)),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
            ],
            options={
                "ordering": ("name",),
            },
        ),
        migrations.CreateModel(
            name="CustomDevice",
            fields=[],
            options={
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("dcim.device",),
        ),
        migrations.CreateModel(
            name="UserProfile",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ("web_config", models.TextField(default="", editable=False)),
                (
                    "user",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="userprofile",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="TransducerType",
            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, unique=True)),
                ("dash", models.BooleanField(blank=True, default=True)),
                ("unit", models.CharField(blank=True, max_length=64)),
                ("safety", models.CharField(blank=True, max_length=64)),
                ("description", models.TextField(blank=True)),
                (
                    "min_custom",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "max_custom",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "min_warning",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "max_warning",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "min_critical",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "max_critical",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "sensor_type",
                    models.ManyToManyField(
                        blank=True,
                        default=None,
                        related_name="transducer_sensor_type",
                        to="netbox_sensors.sensortype",
                    ),
                ),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
            ],
            options={
                "ordering": ("name",),
            },
        ),
        migrations.CreateModel(
            name="Transducer",
            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)),
                ("customer_id", models.CharField(max_length=64)),
                ("dash", models.BooleanField(default=True)),
                (
                    "longitud",
                    models.DecimalField(
                        blank=True, decimal_places=6, default=0.0, max_digits=9
                    ),
                ),
                (
                    "latitud",
                    models.DecimalField(
                        blank=True, decimal_places=6, default=0.0, max_digits=9
                    ),
                ),
                (
                    "elevation",
                    models.DecimalField(
                        blank=True, decimal_places=2, default=0.0, max_digits=9
                    ),
                ),
                ("unit", models.CharField(blank=True, max_length=64)),
                ("serial_number", models.CharField(max_length=100, unique=True)),
                ("safety", models.CharField(blank=True, max_length=64)),
                ("description", models.TextField(blank=True)),
                (
                    "min_custom",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "max_custom",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "min_warning",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "max_warning",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "min_critical",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                (
                    "max_critical",
                    models.DecimalField(
                        blank=True, decimal_places=5, max_digits=12, null=True
                    ),
                ),
                ("icon", models.CharField(default="device_hub", max_length=20)),
                (
                    "sensor",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="sensor",
                        to="netbox_sensors.sensor",
                    ),
                ),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
                (
                    "type",
                    models.ForeignKey(
                        default=None,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="transducer_type",
                        to="netbox_sensors.transducertype",
                    ),
                ),
            ],
            options={
                "ordering": ("name", "type", "sensor"),
            },
        ),
        migrations.AddField(
            model_name="sensor",
            name="device",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to="netbox_sensors.customdevice",
            ),
        ),
        migrations.AddField(
            model_name="sensor",
            name="tags",
            field=taggit.managers.TaggableManager(
                through="extras.TaggedItem", to="extras.Tag"
            ),
        ),
        migrations.AddField(
            model_name="sensor",
            name="type",
            field=models.ManyToManyField(
                blank=True, related_name="sensor_type", to="netbox_sensors.sensortype"
            ),
        ),
    ]
