# Generated by Django 5.0.6 on 2024-07-08 18:25

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("dcim", "0187_alter_device_vc_position"),
        ("extras", "0115_convert_dashboard_widgets"),
    ]

    operations = [
        migrations.CreateModel(
            name="Deploy",
            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)),
                ("type", models.CharField(max_length=50)),
                ("deploy_time", models.DateTimeField(blank=True, null=True)),
                ("devices", models.ManyToManyField(to="dcim.device")),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
            ],
            options={
                "ordering": ("pk",),
            },
        ),
        migrations.CreateModel(
            name="Monitoring",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ("status", models.CharField(max_length=50)),
                ("update_time", models.DateTimeField(auto_now=True)),
                ("log_message", models.TextField(blank=True, null=True)),
                (
                    "deploy",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="netbox_swupdate.deploy",
                    ),
                ),
                (
                    "device",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="dcim.device"
                    ),
                ),
            ],
            options={
                "ordering": ("pk",),
            },
        ),
        migrations.CreateModel(
            name="Repository",
            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)),
                ("type", models.CharField(max_length=50)),
                ("local_path", models.CharField(blank=True, max_length=255, null=True)),
                (
                    "s3_bucket_id",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "s3_access_key",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "s3_secret_key",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "docker_registry_url",
                    models.URLField(blank=True, max_length=255, null=True),
                ),
                (
                    "docker_access_token",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
            ],
            options={
                "ordering": ("pk",),
            },
        ),
        migrations.CreateModel(
            name="Software",
            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)),
                ("version", models.CharField(max_length=50)),
                ("description", models.TextField()),
                ("creation_date", models.DateTimeField(auto_now_add=True)),
                (
                    "repository",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="netbox_swupdate.repository",
                    ),
                ),
                (
                    "tags",
                    taggit.managers.TaggableManager(
                        through="extras.TaggedItem", to="extras.Tag"
                    ),
                ),
            ],
            options={
                "ordering": ("pk",),
            },
        ),
        migrations.AddField(
            model_name="deploy",
            name="software",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to="netbox_swupdate.software",
            ),
        ),
    ]
