# Generated by Django 3.1.7 on 2023-12-08 22:48

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("usermedia", "0002_add_cleanup_schedule"),
        ("repository", "0044_add_deprecate_permission"),
    ]

    operations = [
        migrations.CreateModel(
            name="AsyncPackageSubmission",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("datetime_created", models.DateTimeField(auto_now_add=True)),
                ("datetime_updated", models.DateTimeField(auto_now=True)),
                (
                    "status",
                    models.TextField(
                        choices=[("PENDING", "Pending"), ("FINISHED", "Finished")],
                        default="PENDING",
                    ),
                ),
                ("datetime_scheduled", models.DateTimeField(blank=True, null=True)),
                ("datetime_finished", models.DateTimeField(blank=True, null=True)),
                ("datetime_polled", models.DateTimeField(auto_now_add=True)),
                ("form_data", models.JSONField()),
                ("form_errors", models.JSONField(blank=True, null=True)),
                ("task_error", models.TextField(blank=True, null=True)),
                (
                    "created_version",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="async_package_submission",
                        to="repository.packageversion",
                    ),
                ),
                (
                    "file",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="async_package_submissions",
                        to="usermedia.usermedia",
                    ),
                ),
                (
                    "owner",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="async_package_submissions",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
