# Generated by Django 5.2.10 on 2026-01-24 01:15

from django.core.validators import MinValueValidator
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("recipes", "0001_initial"),
        ("sensors", "0003_thermometerreading"),
    ]

    operations = [
        migrations.CreateModel(
            name="UsbTracker",
            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=128)),
                ("slug", models.SlugField(unique=True)),
                ("description", models.TextField(blank=True)),
                (
                    "required_file_path",
                    models.CharField(
                        help_text="Relative path that must exist on the USB device.",
                        max_length=255,
                    ),
                ),
                (
                    "required_file_regex",
                    models.TextField(
                        blank=True,
                        help_text=(
                            "Optional regex used to validate file contents before "
                            "triggering."
                        ),
                    ),
                ),
                (
                    "cooldown_seconds",
                    models.PositiveIntegerField(
                        default=10,
                        help_text="Minimum seconds between triggers.",
                        validators=[MinValueValidator(1)],
                    ),
                ),
                ("last_checked_at", models.DateTimeField(blank=True, null=True)),
                ("last_matched_at", models.DateTimeField(blank=True, null=True)),
                ("last_triggered_at", models.DateTimeField(blank=True, null=True)),
                ("last_match_path", models.CharField(blank=True, max_length=512)),
                ("last_match_signature", models.CharField(blank=True, max_length=256)),
                ("last_recipe_result", models.TextField(blank=True)),
                ("last_error", models.TextField(blank=True)),
                ("is_active", models.BooleanField(default=True)),
                (
                    "recipe",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="usb_trackers",
                        to="recipes.recipe",
                    ),
                ),
            ],
            options={
                "ordering": ["name"],
                "verbose_name": "USB Tracker",
                "verbose_name_plural": "USB Trackers",
            },
        ),
    ]
