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

import apps.media.models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="MediaBucket",
            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(
                        blank=True, default="", max_length=100, verbose_name="Name"
                    ),
                ),
                (
                    "slug",
                    models.SlugField(
                        default=apps.media.models.media_bucket_slug,
                        max_length=32,
                        unique=True,
                        verbose_name="Upload Path",
                    ),
                ),
                (
                    "allowed_patterns",
                    models.TextField(
                        blank=True,
                        default="",
                        help_text="Newline-separated glob patterns (for example, *.zip or *.log).",
                        verbose_name="Allowed file patterns",
                    ),
                ),
                (
                    "max_bytes",
                    models.BigIntegerField(
                        blank=True,
                        help_text="Reject uploads that exceed this limit.",
                        null=True,
                        verbose_name="Maximum size (bytes)",
                    ),
                ),
                (
                    "expires_at",
                    models.DateTimeField(
                        blank=True,
                        help_text="Stop accepting uploads after this timestamp.",
                        null=True,
                        verbose_name="Accept uploads until",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "verbose_name": "Media Bucket",
                "verbose_name_plural": "Media Buckets",
                "db_table": "protocols_mediabucket",
                "ordering": ("-created_at",),
            },
        ),
        migrations.CreateModel(
            name="MediaFile",
            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.media.models.media_file_path)),
                (
                    "original_name",
                    models.CharField(
                        blank=True,
                        default="",
                        max_length=255,
                        verbose_name="Original name",
                    ),
                ),
                (
                    "content_type",
                    models.CharField(
                        blank=True,
                        default="",
                        max_length=255,
                        verbose_name="Content type",
                    ),
                ),
                (
                    "size",
                    models.BigIntegerField(default=0, verbose_name="Size (bytes)"),
                ),
                ("uploaded_at", models.DateTimeField(auto_now_add=True)),
                (
                    "bucket",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="files",
                        to="media.mediabucket",
                        verbose_name="Bucket",
                    ),
                ),
            ],
            options={
                "verbose_name": "Media File",
                "verbose_name_plural": "Media Files",
                "db_table": "protocols_mediafile",
                "ordering": ("-uploaded_at", "pk"),
            },
        ),
    ]
