# Generated by Django 5.2.11 on 2026-02-15 02:38

import uuid

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0021_alter_patternmitigationcorrection_clarification_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='PatternMitigationAutoSettings',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Stable identifier for this automation settings row.', primary_key=True, serialize=False)),
                ('enabled', models.BooleanField(default=False, help_text='Master toggle for mitigation automation in this conversation.')),
                ('auto_pattern_recognition', models.BooleanField(default=True, help_text='Run pattern/violation recognition automatically when triggered.')),
                ('auto_create_mitigation', models.BooleanField(default=False, help_text='Create a baseline mitigation plan automatically when missing.')),
                ('auto_create_corrections', models.BooleanField(default=False, help_text='Create correction items automatically from detected violations.')),
                ('auto_notify_enabled', models.BooleanField(default=False, help_text='Send NTFY notifications when new violations are detected.')),
                ('ntfy_topic_override', models.CharField(blank=True, help_text='Optional NTFY topic override for automation notifications.', max_length=255, null=True)),
                ('ntfy_url_override', models.CharField(blank=True, help_text='Optional NTFY server URL override for automation notifications.', max_length=255, null=True)),
                ('sample_message_window', models.PositiveIntegerField(default=40, help_text='How many recent messages to include in each automation check.')),
                ('check_cooldown_seconds', models.PositiveIntegerField(default=300, help_text='Minimum seconds between automatic checks for this conversation.')),
                ('last_checked_event_ts', models.BigIntegerField(blank=True, help_text='Latest source message timestamp included in automation checks.', null=True)),
                ('last_run_at', models.DateTimeField(blank=True, help_text='Timestamp when automation last ran.', null=True)),
                ('last_result_summary', models.TextField(blank=True, default='', help_text='Human-readable summary from the last automation run.')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Row creation timestamp.')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Last update timestamp.')),
                ('conversation', models.OneToOneField(help_text='Conversation scope this automation config applies to.', on_delete=django.db.models.deletion.CASCADE, related_name='mitigation_auto_settings', to='core.workspaceconversation')),
                ('user', models.ForeignKey(help_text='Owner of this automation settings row.', on_delete=django.db.models.deletion.CASCADE, related_name='pattern_mitigation_auto_settings', to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
