# Generated by Django 5.2.4 on 2025-07-05 18:45

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


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Task",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("handler", models.CharField(max_length=255)),
                (
                    "payload",
                    models.JSONField(
                        default=dict, encoder=django_skiptask.models.DateTimeEncoder
                    ),
                ),
                ("reattempts", models.IntegerField(default=0)),
                ("run_timeout", models.IntegerField(default=3600)),
                ("queue_timeout", models.IntegerField(default=0)),
                (
                    "created_at",
                    models.DateTimeField(default=django_skiptask.models.utcnow),
                ),
                (
                    "status",
                    models.IntegerField(
                        choices=[(0, "New"), (1, "Completed"), (2, "Errored")],
                        default=0,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Queueable",
            fields=[
                (
                    "task",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        primary_key=True,
                        serialize=False,
                        to="django_skiptask.task",
                    ),
                ),
                ("queue", models.SlugField(default="default")),
                ("key", models.SlugField(null=True, unique=True)),
                ("in_queue", models.BooleanField(default=True)),
                ("priority", models.PositiveSmallIntegerField(default=100)),
            ],
        ),
        migrations.CreateModel(
            name="Attempt",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(default=django_skiptask.models.utcnow),
                ),
                (
                    "status",
                    models.IntegerField(choices=[(1, "Completed"), (2, "Errored")]),
                ),
                ("message", models.TextField(blank=True, default="")),
                (
                    "value",
                    models.JSONField(
                        encoder=django_skiptask.models.DateTimeEncoder, null=True
                    ),
                ),
                (
                    "task",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="django_skiptask.task",
                    ),
                ),
            ],
        ),
    ]
