# Generated by Django 5.2.1 on 2025-06-03 22:11

import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="StorageAccessProfile",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="created",
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="modified",
                    ),
                ),
                (
                    "status",
                    model_utils.fields.StatusField(
                        choices=[("active", "active"), ("inactive", "inactive")],
                        default="active",
                        max_length=100,
                        no_check_for_status=True,
                        verbose_name="status",
                    ),
                ),
                (
                    "status_changed",
                    model_utils.fields.MonitorField(
                        default=django.utils.timezone.now,
                        monitor="status",
                        verbose_name="status changed",
                    ),
                ),
                (
                    "credentials_label",
                    models.CharField(
                        db_index=True,
                        help_text="Key used to look up credentials for this storage backend (e.g., passed to get_fs_from_env())",
                        max_length=128,
                    ),
                ),
                (
                    "backend",
                    models.CharField(
                        choices=[
                            ("s3", "S3"),
                            ("gcs", "GCS"),
                            ("http", "HTTP"),
                            ("file", "Local FS"),
                            ("custom", "Custom"),
                        ],
                        help_text="fsspec-compatible backend name",
                        max_length=50,
                    ),
                ),
                ("description", models.TextField(blank=True)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="StorageMapping",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="created",
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="modified",
                    ),
                ),
                (
                    "status",
                    model_utils.fields.StatusField(
                        choices=[("active", "active"), ("inactive", "inactive")],
                        default="active",
                        max_length=100,
                        no_check_for_status=True,
                        verbose_name="status",
                    ),
                ),
                (
                    "status_changed",
                    model_utils.fields.MonitorField(
                        default=django.utils.timezone.now,
                        monitor="status",
                        verbose_name="status changed",
                    ),
                ),
                (
                    "input_prefix",
                    models.CharField(
                        help_text="Prefix to match incoming URIs (e.g., 's3://source-bucket/')",
                        max_length=255,
                        unique=True,
                    ),
                ),
                (
                    "output_base_uri",
                    models.CharField(
                        help_text="Base URI where Zarr files will be written (e.g., 'file:///tmp/zarr/' or 's3://target-bucket/encoded/')",
                        max_length=500,
                    ),
                ),
                (
                    "input_profile",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="input_mappings",
                        to="django_zarr_audio.storageaccessprofile",
                    ),
                ),
                (
                    "output_profile",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="output_mappings",
                        to="django_zarr_audio.storageaccessprofile",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="AudioFile",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="created",
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="modified",
                    ),
                ),
                (
                    "status",
                    model_utils.fields.StatusField(
                        choices=[
                            ("initializing", "initializing"),
                            ("queued", "queued"),
                            ("encoding", "encoding"),
                            ("encoded", "encoded"),
                            ("exception_returned", "exception_returned"),
                        ],
                        default="initializing",
                        max_length=100,
                        no_check_for_status=True,
                        verbose_name="status",
                    ),
                ),
                (
                    "status_changed",
                    model_utils.fields.MonitorField(
                        default=django.utils.timezone.now,
                        monitor="status",
                        verbose_name="status changed",
                    ),
                ),
                (
                    "uri",
                    models.CharField(
                        help_text="Full fsspec-compatible input URI (e.g., 's3://bucket/audio.wav')",
                        max_length=512,
                    ),
                ),
                (
                    "zarr_uri",
                    models.CharField(
                        blank=True,
                        help_text="Full output URI where the encoded Zarr archive was written",
                        max_length=512,
                        null=True,
                    ),
                ),
                (
                    "storage_mapping",
                    models.ForeignKey(
                        help_text="Routing configuration used to encode this file",
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="audio_files",
                        to="django_zarr_audio.storagemapping",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
