# Generated by Django 5.2 on 2025-04-29 08:54

import django.db.models.deletion
import django.utils.timezone
import djpress.models.media
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        ("djpress", "0010_tag_post_tags"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Media",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "title",
                    models.CharField(help_text="A title for the media file", max_length=255, verbose_name="Title"),
                ),
                (
                    "file",
                    models.FileField(
                        help_text="The uploaded file",
                        upload_to=djpress.models.media.upload_to_path,
                        verbose_name="File",
                    ),
                ),
                (
                    "media_type",
                    models.CharField(
                        choices=[
                            ("image", "Image"),
                            ("document", "Document"),
                            ("audio", "Audio"),
                            ("video", "Video"),
                            ("other", "Other"),
                        ],
                        default="image",
                        help_text="The type of media file",
                        max_length=20,
                        verbose_name="Media Type",
                    ),
                ),
                (
                    "alt_text",
                    models.CharField(
                        blank=True,
                        help_text="Alternative text for images (for accessibility)",
                        max_length=255,
                        verbose_name="Alt Text",
                    ),
                ),
                (
                    "description",
                    models.TextField(
                        blank=True, help_text="A description of the media file", verbose_name="Description"
                    ),
                ),
                ("date", models.DateTimeField(default=django.utils.timezone.now)),
                ("modified_date", models.DateTimeField(auto_now=True)),
                (
                    "uploaded_by",
                    models.ForeignKey(
                        help_text="The user who uploaded the file",
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="media_files",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="Uploaded By",
                    ),
                ),
            ],
            options={
                "verbose_name": "Media",
                "verbose_name_plural": "Media",
                "ordering": ["-date"],
            },
        ),
    ]
