# Generated by Django 5.2 on 2026-01-10 19:38

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0257_intelligencetier_alter_browserllmtier_options_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='PersistentAgentKanbanEvent',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('cursor_value', models.BigIntegerField()),
                ('cursor_identifier', models.UUIDField(unique=True)),
                ('display_text', models.TextField()),
                ('primary_action', models.CharField(choices=[('created', 'Created'), ('started', 'Started'), ('completed', 'Completed'), ('updated', 'Updated'), ('deleted', 'Deleted'), ('archived', 'Archived')], max_length=16)),
                ('todo_count', models.PositiveIntegerField(default=0)),
                ('doing_count', models.PositiveIntegerField(default=0)),
                ('done_count', models.PositiveIntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('agent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='kanban_events', to='api.persistentagent')),
            ],
            options={
                'ordering': ['-cursor_value', '-cursor_identifier'],
            },
        ),
        migrations.CreateModel(
            name='PersistentAgentKanbanEventChange',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('card_id', models.UUIDField()),
                ('title', models.CharField(max_length=255)),
                ('action', models.CharField(choices=[('created', 'Created'), ('started', 'Started'), ('completed', 'Completed'), ('updated', 'Updated'), ('deleted', 'Deleted'), ('archived', 'Archived')], max_length=16)),
                ('from_status', models.CharField(blank=True, choices=[('todo', 'To Do'), ('doing', 'Doing'), ('done', 'Done')], max_length=16, null=True)),
                ('to_status', models.CharField(blank=True, choices=[('todo', 'To Do'), ('doing', 'Doing'), ('done', 'Done')], max_length=16, null=True)),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='changes', to='api.persistentagentkanbanevent')),
            ],
            options={
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='PersistentAgentKanbanEventTitle',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.CharField(choices=[('todo', 'To Do'), ('doing', 'Doing'), ('done', 'Done')], max_length=16)),
                ('position', models.PositiveSmallIntegerField()),
                ('title', models.CharField(max_length=255)),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='titles', to='api.persistentagentkanbanevent')),
            ],
            options={
                'ordering': ['status', 'position'],
            },
        ),
        migrations.AddIndex(
            model_name='persistentagentkanbanevent',
            index=models.Index(fields=['agent', '-cursor_value'], name='kanban_event_agent_recent_idx'),
        ),
        migrations.AddIndex(
            model_name='persistentagentkanbaneventchange',
            index=models.Index(fields=['event'], name='kanban_event_change_idx'),
        ),
        migrations.AddIndex(
            model_name='persistentagentkanbaneventtitle',
            index=models.Index(fields=['event', 'status', 'position'], name='kanban_event_title_idx'),
        ),
    ]
