import django.db.models.deletion
import uuid

from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        ("processing", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="ImageState",
            fields=[
                ("id", models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ("sequence", models.PositiveIntegerField(default=0)),
                ("label", models.CharField(max_length=120)),
                ("operation", models.CharField(max_length=96)),
                ("params", models.JSONField(blank=True, default=dict)),
                ("image", models.CharField(max_length=255)),
                ("width", models.PositiveIntegerField()),
                ("height", models.PositiveIntegerField()),
                ("channels", models.PositiveSmallIntegerField()),
                ("color_mode", models.CharField(max_length=16)),
                ("histogram", models.JSONField(default=dict)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "parent",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="children",
                        to="processing.imagestate",
                    ),
                ),
                (
                    "session",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="states",
                        to="processing.imagesession",
                    ),
                ),
            ],
            options={
                "ordering": ["sequence", "created_at"],
            },
        ),
    ]
