# Generated by Django 5.2 on 2025-04-04 09:40

import django.core.serializers.json
import django.db.models.deletion
import django.utils.timezone
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='CloudChain',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('RUNNING', 'Running'), ('SUCCESS', 'Success'), ('FAILED', 'Failed')], default='PENDING', max_length=20)),
                ('result', models.JSONField(blank=True, default=None, encoder=django.core.serializers.json.DjangoJSONEncoder, null=True)),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('parent_chain', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='django_cloudtasks.cloudchain')),
            ],
        ),
        migrations.CreateModel(
            name='CloudTask',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('endpoint_path', models.CharField(blank=True, max_length=255, null=True)),
                ('payload', models.JSONField(default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('delay_seconds', models.PositiveIntegerField(default=0)),
                ('is_group', models.BooleanField(default=False)),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('SCHEDULED', 'Scheduled'), ('SUCCESS', 'Success'), ('FAILED', 'Failed'), ('ERROR', 'Error'), ('REVOKED', 'Revoked')], default='PENDING', max_length=20)),
                ('execution_result', models.JSONField(blank=True, encoder=django.core.serializers.json.DjangoJSONEncoder, null=True)),
                ('external_task_name', models.CharField(blank=True, help_text='Google Cloud Tasks service task name for revocation management.', max_length=500, null=True)),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('chain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tasks', to='django_cloudtasks.cloudchain')),
                ('next_task', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='django_cloudtasks.cloudtask')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='django_cloudtasks.cloudtask')),
            ],
        ),
    ]
