# Generated by Django 3.2.16 on 2023-03-01 08:21

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

import resolwe.observers.models


class Migration(migrations.Migration):
    dependencies = [
        ("permissions", "0004_create_anonymous_user"),
        ("observers", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="BackgroundTask",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("started", models.DateTimeField(blank=True, db_index=True, null=True)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("WT", "Waiting"),
                            ("PR", "Processing"),
                            ("OK", "Done"),
                            ("ER", "Error"),
                        ],
                        default="WT",
                        max_length=2,
                    ),
                ),
                (
                    "finished",
                    models.DateTimeField(blank=True, db_index=True, null=True),
                ),
                ("description", models.CharField(max_length=256)),
                (
                    "output",
                    models.JSONField(
                        default=resolwe.observers.models._default_output_value
                    ),
                ),
                (
                    "permission_group",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="backgroundtask",
                        to="permissions.permissiongroup",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
