# Generated by Django 5.2.9 on 2026-01-03 22:57

import apps.logbook.models
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("content", "0003_initial"),
        ("nodes", "0010_noderole_acronym"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="LogbookEntry",
            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)),
                (
                    "secret",
                    models.CharField(editable=False, max_length=16, unique=True),
                ),
                ("title", models.CharField(max_length=200)),
                ("report", models.TextField()),
                ("event_at", models.DateTimeField(blank=True, null=True)),
                ("debug_info", models.JSONField(blank=True, null=True)),
                (
                    "debug_document",
                    models.FileField(
                        blank=True, upload_to=apps.logbook.models._debug_upload_path
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "content_samples",
                    models.ManyToManyField(
                        blank=True,
                        related_name="logbook_entries",
                        to="content.contentsample",
                    ),
                ),
                (
                    "node",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="logbook_entries",
                        to="nodes.node",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="logbook_entries",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Logbook Entry",
                "verbose_name_plural": "Logbook Entries",
                "ordering": ["-created_at"],
            },
        ),
        migrations.CreateModel(
            name="LogbookLogAttachment",
            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)),
                (
                    "file",
                    models.FileField(
                        upload_to=apps.logbook.models._logbook_upload_path
                    ),
                ),
                ("original_name", models.CharField(max_length=255)),
                ("size", models.PositiveIntegerField(default=0)),
                (
                    "entry",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="log_attachments",
                        to="logbook.logbookentry",
                    ),
                ),
            ],
            options={
                "verbose_name": "Logbook Log Attachment",
                "verbose_name_plural": "Logbook Log Attachments",
                "ordering": ["original_name"],
            },
        ),
    ]
