# Generated by Django 6.0.1 on 2026-01-11 01:11

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Volume",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.SlugField(
                        help_text="Unique identifier (alphanumeric and hyphens only)",
                        max_length=100,
                        unique=True,
                    ),
                ),
                (
                    "verbose_name",
                    models.CharField(help_text="Display name", max_length=200),
                ),
                (
                    "path",
                    models.CharField(
                        help_text="Absolute path on the filesystem",
                        max_length=500,
                        unique=True,
                    ),
                ),
                (
                    "public_read",
                    models.BooleanField(
                        default=False,
                        help_text="Allow public read access (no login required)",
                    ),
                ),
                ("is_active", models.BooleanField(default=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
            ],
            options={
                "verbose_name": "Volume",
                "verbose_name_plural": "Volumes",
            },
        ),
        migrations.CreateModel(
            name="VolumePermission",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "role",
                    models.CharField(
                        choices=[("viewer", "Viewer"), ("editor", "Editor")],
                        default="viewer",
                        max_length=20,
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="volume_permissions",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "volume",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="permissions",
                        to="filechest.volume",
                    ),
                ),
            ],
            options={
                "verbose_name": "Volume Permission",
                "verbose_name_plural": "Volume Permissions",
                "unique_together": {("user", "volume")},
            },
        ),
    ]
