# Generated by Django 5.2.8 on 2025-12-06 15:03

import apps.sigils.fields
import django.core.validators
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="NetMessage",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "uuid",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        unique=True,
                        verbose_name="UUID",
                    ),
                ),
                ("subject", models.CharField(blank=True, max_length=64)),
                ("body", models.CharField(blank=True, max_length=256)),
                ("attachments", models.JSONField(blank=True, null=True)),
                (
                    "filter_current_relation",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("UPSTREAM", "Upstream"),
                            ("DOWNSTREAM", "Downstream"),
                            ("PEER", "Peer"),
                            ("SELF", "Self"),
                        ],
                        max_length=10,
                        verbose_name="Current relation",
                    ),
                ),
                (
                    "filter_installed_version",
                    models.CharField(
                        blank=True, max_length=20, verbose_name="Installed version"
                    ),
                ),
                (
                    "filter_installed_revision",
                    models.CharField(
                        blank=True, max_length=40, verbose_name="Installed revision"
                    ),
                ),
                (
                    "target_limit",
                    models.PositiveSmallIntegerField(
                        blank=True,
                        default=6,
                        help_text="Maximum number of peers to contact when propagating.",
                        null=True,
                    ),
                ),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("complete", models.BooleanField(default=False, editable=False)),
            ],
            options={
                "verbose_name": "Net Message",
                "verbose_name_plural": "Net Messages",
                "ordering": ["-created"],
            },
        ),
        migrations.CreateModel(
            name="Node",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("hostname", models.CharField(max_length=100)),
                ("network_hostname", models.CharField(blank=True, max_length=253)),
                ("ipv4_address", models.TextField(blank=True)),
                (
                    "ipv6_address",
                    models.CharField(
                        blank=True,
                        max_length=39,
                        validators=[django.core.validators.validate_ipv6_address],
                    ),
                ),
                (
                    "address",
                    models.CharField(
                        blank=True,
                        max_length=45,
                        validators=[django.core.validators.validate_ipv46_address],
                    ),
                ),
                ("mac_address", models.CharField(blank=True, max_length=17)),
                ("port", models.PositiveIntegerField(default=8888)),
                (
                    "trusted",
                    models.BooleanField(
                        default=False,
                        help_text="Mark the node as trusted for network interactions.",
                    ),
                ),
                (
                    "message_queue_length",
                    models.PositiveSmallIntegerField(
                        default=10,
                        help_text="Maximum queued NetMessages to retain for this peer.",
                    ),
                ),
                ("badge_color", models.CharField(default="#28a745", max_length=7)),
                (
                    "current_relation",
                    models.CharField(
                        choices=[
                            ("UPSTREAM", "Upstream"),
                            ("DOWNSTREAM", "Downstream"),
                            ("PEER", "Peer"),
                            ("SELF", "Self"),
                        ],
                        default="PEER",
                        max_length=10,
                    ),
                ),
                ("last_seen", models.DateTimeField(auto_now=True)),
                ("public_endpoint", models.SlugField(blank=True, unique=True)),
                (
                    "uuid",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        unique=True,
                        verbose_name="UUID",
                    ),
                ),
                ("public_key", models.TextField(blank=True)),
                ("base_path", models.CharField(blank=True, max_length=255)),
                ("installed_version", models.CharField(blank=True, max_length=20)),
                ("installed_revision", models.CharField(blank=True, max_length=40)),
            ],
            options={
                "verbose_name": "Node",
                "verbose_name_plural": "Nodes",
            },
        ),
        migrations.CreateModel(
            name="NodeFeature",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("slug", models.SlugField(unique=True)),
                ("display", models.CharField(max_length=50)),
            ],
            options={
                "verbose_name": "Node Feature",
                "verbose_name_plural": "Node Features",
                "ordering": ["display"],
            },
        ),
        migrations.CreateModel(
            name="NodeFeatureAssignment",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
            ],
            options={
                "verbose_name": "Node Feature Assignment",
                "verbose_name_plural": "Node Feature Assignments",
            },
        ),
        migrations.CreateModel(
            name="NodeManager",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "provider",
                    models.CharField(
                        choices=[("godaddy", "GoDaddy")],
                        default="godaddy",
                        max_length=20,
                    ),
                ),
                (
                    "api_key",
                    apps.sigils.fields.SigilShortAutoField(
                        help_text="API key issued by the DNS provider.",
                        max_length=255,
                        verbose_name="API key",
                    ),
                ),
                (
                    "api_secret",
                    apps.sigils.fields.SigilShortAutoField(
                        help_text="API secret issued by the DNS provider.",
                        max_length=255,
                        verbose_name="API secret",
                    ),
                ),
                (
                    "customer_id",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True,
                        help_text="Optional GoDaddy customer identifier for the account.",
                        max_length=100,
                        verbose_name="Customer ID",
                    ),
                ),
                (
                    "default_domain",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True,
                        help_text="Fallback domain when records omit one.",
                        max_length=253,
                    ),
                ),
                (
                    "use_sandbox",
                    models.BooleanField(
                        default=False,
                        help_text="Use the GoDaddy OTE (test) environment.",
                    ),
                ),
                (
                    "is_enabled",
                    models.BooleanField(
                        default=True,
                        help_text="Disable to prevent deployments with this manager.",
                    ),
                ),
            ],
            options={
                "verbose_name": "Node Manager",
                "verbose_name_plural": "Node Managers",
            },
        ),
        migrations.CreateModel(
            name="NodeRole",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("name", models.CharField(max_length=50, unique=True)),
                ("description", models.CharField(blank=True, max_length=200)),
            ],
            options={
                "verbose_name": "Node Role",
                "verbose_name_plural": "Node Roles",
                "ordering": ["name"],
            },
        ),
        migrations.CreateModel(
            name="NodeService",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("slug", models.SlugField(unique=True)),
                ("display", models.CharField(max_length=100)),
                (
                    "unit_template",
                    models.CharField(
                        help_text="Pattern for the systemd unit name (for example {service_name}.service).",
                        max_length=150,
                    ),
                ),
                (
                    "is_required",
                    models.BooleanField(
                        default=False,
                        help_text="Mark as required when the service should always be present.",
                    ),
                ),
                (
                    "template_path",
                    models.CharField(
                        blank=True,
                        help_text="Path to the service template stored in the repository.",
                        max_length=255,
                    ),
                ),
                (
                    "template_content",
                    models.TextField(
                        blank=True,
                        help_text="Stored copy of the service template for reference.",
                    ),
                ),
            ],
            options={
                "verbose_name": "Node Service",
                "verbose_name_plural": "Node Services",
                "ordering": ["display"],
            },
        ),
        migrations.CreateModel(
            name="PendingNetMessage",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("seen", models.JSONField(default=list)),
                ("queued_at", models.DateTimeField(auto_now_add=True)),
                ("stale_at", models.DateTimeField()),
            ],
            options={
                "verbose_name": "Pending Net Message",
                "verbose_name_plural": "Pending Net Messages",
                "ordering": ("queued_at",),
            },
        ),
    ]
