# Generated by Django 5.2.12 on 2026-04-17 18:44

import uuid

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("app_data", "0030_alter_dataschema_dataformat"),
    ]

    operations = [
        migrations.CreateModel(
            name="DataTask",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "handle",
                    models.UUIDField(db_index=True, default=uuid.uuid4, unique=True),
                ),
                (
                    "owner_type",
                    models.CharField(
                        choices=[("user", "User"), ("api", "API"), ("auto", "Auto")],
                        default="user",
                        max_length=16,
                    ),
                ),
                ("owner_id", models.CharField(db_index=True, max_length=128)),
                ("name", models.CharField(max_length=256)),
                (
                    "singleton",
                    models.CharField(
                        blank=True, db_index=True, max_length=64, null=True
                    ),
                ),
                (
                    "state",
                    models.CharField(
                        choices=[
                            ("QUEUED", "Queued"),
                            ("RUNNING", "Running"),
                            ("DONE", "Done"),
                            ("FAILED", "Failed"),
                            ("ABORTED", "Aborted"),
                        ],
                        db_index=True,
                        default="QUEUED",
                        max_length=16,
                    ),
                ),
                ("params", models.JSONField(blank=True, null=True)),
                ("progress", models.JSONField(blank=True, null=True)),
                ("output", models.JSONField(blank=True, null=True)),
                ("attachment", models.JSONField(blank=True, null=True)),
                ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
                ("finished_at", models.DateTimeField(blank=True, null=True)),
            ],
            options={
                "verbose_name": "Data Task",
                "verbose_name_plural": "Data Tasks",
                "db_table": "data_task",
                "ordering": ["-created_at"],
            },
        ),
    ]
