# Generated by Django 5.1.15 on 2026-05-29 03:59

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="ModelConfig",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=128)),
                ("display_name", models.CharField(max_length=128)),
                (
                    "capability",
                    models.CharField(
                        choices=[
                            ("text", "Text"),
                            ("image", "Image"),
                            ("video", "Video"),
                            ("vision", "Vision"),
                            ("export", "Export"),
                        ],
                        max_length=32,
                    ),
                ),
                ("endpoint", models.CharField(blank=True, max_length=255)),
                (
                    "unit_price",
                    models.DecimalField(decimal_places=4, default=0, max_digits=12),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[("active", "Active"), ("disabled", "Disabled")],
                        default="active",
                        max_length=24,
                    ),
                ),
                ("rate_limit_per_minute", models.PositiveIntegerField(default=60)),
                ("metadata", models.JSONField(blank=True, default=dict)),
            ],
        ),
        migrations.CreateModel(
            name="ModelProvider",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=64, unique=True)),
                ("display_name", models.CharField(max_length=128)),
                (
                    "status",
                    models.CharField(
                        choices=[("active", "Active"), ("disabled", "Disabled")],
                        default="active",
                        max_length=24,
                    ),
                ),
                ("base_url", models.URLField(blank=True)),
                ("metadata", models.JSONField(blank=True, default=dict)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="AITask",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "task_type",
                    models.CharField(
                        choices=[
                            ("script_generation", "Script Generation"),
                            ("script_optimization", "Script Optimization"),
                            ("product_image", "Product Image"),
                            ("person_image", "Person Image"),
                            ("scene_image", "Scene Image"),
                            ("storyboard", "Storyboard"),
                            ("video_segment", "Video Segment"),
                            ("export", "Export"),
                        ],
                        max_length=48,
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("created", "Created"),
                            ("reserved", "Reserved"),
                            ("submitted", "Submitted"),
                            ("polling", "Polling"),
                            ("postprocessing", "Postprocessing"),
                            ("succeeded", "Succeeded"),
                            ("failed", "Failed"),
                            ("compensating", "Compensating"),
                            ("cancelled", "Cancelled"),
                        ],
                        default="created",
                        max_length=32,
                    ),
                ),
                ("idempotency_key", models.CharField(max_length=128, unique=True)),
                ("provider_task_id", models.CharField(blank=True, max_length=255)),
                ("request_payload", models.JSONField(blank=True, default=dict)),
                ("response_payload", models.JSONField(blank=True, default=dict)),
                (
                    "estimated_cost",
                    models.DecimalField(decimal_places=4, default=0, max_digits=12),
                ),
                (
                    "actual_cost",
                    models.DecimalField(decimal_places=4, default=0, max_digits=12),
                ),
                ("error_code", models.CharField(blank=True, max_length=64)),
                ("error_message", models.TextField(blank=True)),
                ("submitted_at", models.DateTimeField(blank=True, null=True)),
                ("completed_at", models.DateTimeField(blank=True, null=True)),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="created_%(class)s_set",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
    ]
