# Generated by Django 5.2 on 2025-06-26 12:45

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0046_persistentagentcrontrigger'),
    ]

    operations = [
        migrations.CreateModel(
            name='PersistentAgentCommsSnapshot',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('snapshot_until', models.DateTimeField(help_text='Inclusive upper bound of message timestamps represented in this snapshot')),
                ('summary', models.TextField(help_text='Agent-readable or machine-readable summary of communications up to snapshot_until')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('agent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comms_snapshots', to='api.persistentagent')),
                ('previous_snapshot', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='next_snapshot', to='api.persistentagentcommssnapshot')),
            ],
            options={
                'ordering': ['-snapshot_until'],
                'indexes': [models.Index(fields=['agent', '-snapshot_until'], name='pa_snapshot_recent_idx')],
                'constraints': [models.UniqueConstraint(fields=('agent', 'snapshot_until'), name='unique_agent_snapshot_until')],
            },
        ),
        migrations.CreateModel(
            name='PersistentAgentStepSnapshot',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('snapshot_until', models.DateTimeField(help_text='Inclusive upper bound of step.created_at values represented in this snapshot')),
                ('summary', models.TextField(help_text='Summary of agent steps up to snapshot_until')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('agent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='step_snapshots', to='api.persistentagent')),
                ('previous_snapshot', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='next_snapshot', to='api.persistentagentstepsnapshot')),
            ],
            options={
                'ordering': ['-snapshot_until'],
                'indexes': [models.Index(fields=['agent', '-snapshot_until'], name='pa_step_snapshot_recent_idx')],
                'constraints': [models.UniqueConstraint(fields=('agent', 'snapshot_until'), name='unique_agent_step_snapshot_until')],
            },
        ),
    ]
