# Generated by Django 5.2.8 on 2025-12-03 16:06

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


class Migration(migrations.Migration):

    dependencies = [
        ('automation', '0002_add_delay_configuration'),
        ('igny8_core_auth', '0003_add_sync_event_model'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='automationconfig',
            options={'verbose_name': 'Automation Config', 'verbose_name_plural': 'Automation Configs'},
        ),
        migrations.AlterModelOptions(
            name='automationrun',
            options={'ordering': ['-started_at'], 'verbose_name': 'Automation Run', 'verbose_name_plural': 'Automation Runs'},
        ),
        migrations.RemoveIndex(
            model_name='automationrun',
            name='automation_site_status_idx',
        ),
        migrations.RemoveIndex(
            model_name='automationrun',
            name='automation_site_started_idx',
        ),
        migrations.AlterField(
            model_name='automationconfig',
            name='account',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='automation_configs', to='igny8_core_auth.account'),
        ),
        migrations.AlterField(
            model_name='automationconfig',
            name='is_enabled',
            field=models.BooleanField(default=False, help_text='Whether scheduled automation is active'),
        ),
        migrations.AlterField(
            model_name='automationconfig',
            name='next_run_at',
            field=models.DateTimeField(blank=True, help_text='Calculated based on frequency', null=True),
        ),
        migrations.AlterField(
            model_name='automationconfig',
            name='scheduled_time',
            field=models.TimeField(default='02:00', help_text='Time to run (e.g., 02:00)'),
        ),
        migrations.AlterField(
            model_name='automationconfig',
            name='stage_1_batch_size',
            field=models.IntegerField(default=20, help_text='Keywords per batch'),
        ),
        migrations.AlterField(
            model_name='automationconfig',
            name='stage_2_batch_size',
            field=models.IntegerField(default=1, help_text='Clusters at a time'),
        ),
        migrations.AlterField(
            model_name='automationconfig',
            name='stage_3_batch_size',
            field=models.IntegerField(default=20, help_text='Ideas per batch'),
        ),
        migrations.AlterField(
            model_name='automationconfig',
            name='stage_4_batch_size',
            field=models.IntegerField(default=1, help_text='Tasks - sequential'),
        ),
        migrations.AlterField(
            model_name='automationconfig',
            name='stage_5_batch_size',
            field=models.IntegerField(default=1, help_text='Content at a time'),
        ),
        migrations.AlterField(
            model_name='automationconfig',
            name='stage_6_batch_size',
            field=models.IntegerField(default=1, help_text='Images - sequential'),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='account',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='automation_runs', to='igny8_core_auth.account'),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='current_stage',
            field=models.IntegerField(default=1, help_text='Current stage number (1-7)'),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='run_id',
            field=models.CharField(db_index=True, help_text='Format: run_20251203_140523_manual', max_length=100, unique=True),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='stage_1_result',
            field=models.JSONField(blank=True, help_text='{keywords_processed, clusters_created, batches}', null=True),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='stage_2_result',
            field=models.JSONField(blank=True, help_text='{clusters_processed, ideas_created}', null=True),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='stage_3_result',
            field=models.JSONField(blank=True, help_text='{ideas_processed, tasks_created}', null=True),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='stage_4_result',
            field=models.JSONField(blank=True, help_text='{tasks_processed, content_created, total_words}', null=True),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='stage_5_result',
            field=models.JSONField(blank=True, help_text='{content_processed, prompts_created}', null=True),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='stage_6_result',
            field=models.JSONField(blank=True, help_text='{images_processed, images_generated}', null=True),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='stage_7_result',
            field=models.JSONField(blank=True, help_text='{ready_for_review}', null=True),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='started_at',
            field=models.DateTimeField(auto_now_add=True, db_index=True),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='status',
            field=models.CharField(choices=[('running', 'Running'), ('paused', 'Paused'), ('completed', 'Completed'), ('failed', 'Failed')], db_index=True, default='running', max_length=20),
        ),
        migrations.AlterField(
            model_name='automationrun',
            name='trigger_type',
            field=models.CharField(choices=[('manual', 'Manual'), ('scheduled', 'Scheduled')], max_length=20),
        ),
        migrations.AddIndex(
            model_name='automationconfig',
            index=models.Index(fields=['is_enabled', 'next_run_at'], name='igny8_autom_is_enab_038ce6_idx'),
        ),
        migrations.AddIndex(
            model_name='automationconfig',
            index=models.Index(fields=['account', 'site'], name='igny8_autom_account_c6092f_idx'),
        ),
        migrations.AddIndex(
            model_name='automationrun',
            index=models.Index(fields=['site', '-started_at'], name='igny8_autom_site_id_b5bf36_idx'),
        ),
        migrations.AddIndex(
            model_name='automationrun',
            index=models.Index(fields=['status', '-started_at'], name='igny8_autom_status_1457b0_idx'),
        ),
        migrations.AddIndex(
            model_name='automationrun',
            index=models.Index(fields=['account', '-started_at'], name='igny8_autom_account_27cb3c_idx'),
        ),
    ]
