# Generated by Django 6.0 on 2026-03-02 09:56

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


class Migration(migrations.Migration):
    dependencies = [
        ("endoreg_db", "0006_applicationsettings"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="PdfProcessingHistory",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "operation",
                    models.CharField(
                        choices=[("pdf_redaction", "PDF Redaction")],
                        default="pdf_redaction",
                        max_length=64,
                    ),
                ),
                (
                    "source_type",
                    models.CharField(
                        choices=[("raw", "Raw"), ("processed", "Processed")],
                        max_length=16,
                    ),
                ),
                ("redaction_manifest", models.JSONField(default=dict)),
                ("note", models.TextField(blank=True)),
                ("client_source_sha256", models.CharField(blank=True, max_length=64)),
                ("source_sha256", models.CharField(blank=True, max_length=64)),
                ("processed_file_name", models.CharField(blank=True, max_length=500)),
                ("actor_username", models.CharField(blank=True, max_length=150)),
                ("actor_email", models.EmailField(blank=True, max_length=254)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "actor_user",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="pdf_processing_history_entries",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "pdf",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="pdf_processing_history",
                        to="endoreg_db.rawpdffile",
                    ),
                ),
            ],
            options={
                "db_table": "pdf_processing_history",
                "ordering": ["-created_at"],
                "indexes": [
                    models.Index(
                        fields=["pdf", "-created_at"],
                        name="pdf_process_pdf_id_7a0c66_idx",
                    ),
                    models.Index(
                        fields=["operation"], name="pdf_process_operati_b6cc8f_idx"
                    ),
                ],
            },
        ),
    ]
