# Generated by Django 5.2 on 2025-08-29 18:12

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0106_alter_persistentagent_whitelist_policy'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='persistentagent',
            name='last_expired_at',
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='persistentagent',
            name='last_interaction_at',
            field=models.DateTimeField(blank=True, help_text='Timestamp of the last user interaction (reply, edit, etc.).', null=True),
        ),
        migrations.AddField(
            model_name='persistentagent',
            name='life_state',
            field=models.CharField(choices=[('active', 'Active'), ('expired', 'Expired')], default='active', help_text="Lifecycle state for soft-expiration. 'paused' is represented by is_active=False.", max_length=16),
        ),
        migrations.AddField(
            model_name='persistentagent',
            name='schedule_snapshot',
            field=models.CharField(blank=True, help_text='Snapshot of cron schedule for restoration.', max_length=128, null=True),
        ),
        migrations.AddField(
            model_name='persistentagent',
            name='sleep_email_sent_at',
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='userbilling',
            name='downgraded_at',
            field=models.DateTimeField(blank=True, help_text='Timestamp when user was downgraded to free (for soft-expiration grace).', null=True),
        ),
        migrations.AddIndex(
            model_name='persistentagent',
            index=models.Index(fields=['life_state', 'is_active'], name='pa_life_active_idx'),
        ),
        migrations.AddIndex(
            model_name='persistentagent',
            index=models.Index(fields=['last_interaction_at'], name='pa_last_interact_idx'),
        ),
    ]
