# Generated by Django 5.1.2 on 2024-10-30 00:41

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="EditSubmission",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("object_id", models.PositiveIntegerField()),
                (
                    "changes",
                    models.JSONField(
                        help_text="JSON representation of the changes made"
                    ),
                ),
                ("reason", models.TextField(help_text="Why this edit is needed")),
                (
                    "source",
                    models.TextField(
                        blank=True,
                        help_text="Source of information for this edit (if applicable)",
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("PENDING", "Pending"),
                            ("APPROVED", "Approved"),
                            ("REJECTED", "Rejected"),
                            ("AUTO_APPROVED", "Auto Approved"),
                        ],
                        default="PENDING",
                        max_length=20,
                    ),
                ),
                ("submitted_at", models.DateTimeField(auto_now_add=True)),
                ("reviewed_at", models.DateTimeField(blank=True, null=True)),
                (
                    "review_notes",
                    models.TextField(
                        blank=True,
                        help_text="Notes from the moderator about this submission",
                    ),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.contenttype",
                    ),
                ),
                (
                    "reviewed_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="reviewed_submissions",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="edit_submissions",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "ordering": ["-submitted_at"],
                "indexes": [
                    models.Index(
                        fields=["content_type", "object_id"],
                        name="moderation__content_922d2b_idx",
                    ),
                    models.Index(
                        fields=["status"], name="moderation__status_e4eb2b_idx"
                    ),
                ],
            },
        ),
        migrations.CreateModel(
            name="PhotoSubmission",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("object_id", models.PositiveIntegerField()),
                ("photo", models.ImageField(upload_to="submissions/photos/")),
                ("caption", models.CharField(blank=True, max_length=255)),
                ("date_taken", models.DateField(blank=True, null=True)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("PENDING", "Pending"),
                            ("APPROVED", "Approved"),
                            ("REJECTED", "Rejected"),
                            ("AUTO_APPROVED", "Auto Approved"),
                        ],
                        default="PENDING",
                        max_length=20,
                    ),
                ),
                ("submitted_at", models.DateTimeField(auto_now_add=True)),
                ("reviewed_at", models.DateTimeField(blank=True, null=True)),
                (
                    "review_notes",
                    models.TextField(
                        blank=True,
                        help_text="Notes from the moderator about this photo submission",
                    ),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.contenttype",
                    ),
                ),
                (
                    "reviewed_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="reviewed_photos",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="photo_submissions",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "ordering": ["-submitted_at"],
                "indexes": [
                    models.Index(
                        fields=["content_type", "object_id"],
                        name="moderation__content_7a7bc1_idx",
                    ),
                    models.Index(
                        fields=["status"], name="moderation__status_7a1914_idx"
                    ),
                ],
            },
        ),
    ]
