# Generated by Django 5.2.11 on 2026-02-15 00:58

import uuid

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0017_remove_airesult_risk_flags_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='PatternMitigationPlan',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Stable identifier for this mitigation plan.', primary_key=True, serialize=False)),
                ('title', models.CharField(blank=True, default='', help_text='Display title for this plan.', max_length=255)),
                ('objective', models.TextField(blank=True, default='', help_text='High-level objective this plan is meant to achieve.')),
                ('fundamental_items', models.JSONField(blank=True, default=list, help_text='Foundational agreed items/principles for this plan.')),
                ('creation_mode', models.CharField(choices=[('auto', 'Auto'), ('guided', 'Guided')], default='auto', help_text='Whether plan artifacts were generated automatically or user-guided.', max_length=16)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('active', 'Active'), ('archived', 'Archived')], default='draft', help_text='Lifecycle status of the plan.', max_length=16)),
                ('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.ForeignKey(help_text='Workspace conversation this plan belongs to.', on_delete=django.db.models.deletion.CASCADE, related_name='mitigation_plans', to='core.workspaceconversation')),
                ('source_ai_result', models.ForeignKey(blank=True, help_text='AI result that initiated this plan, if any.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='mitigation_plans', to='core.airesult')),
                ('user', models.ForeignKey(help_text='Owner of this plan.', on_delete=django.db.models.deletion.CASCADE, related_name='pattern_mitigation_plans', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='PatternMitigationMessage',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Stable identifier for this mitigation message.', primary_key=True, serialize=False)),
                ('role', models.CharField(choices=[('user', 'User'), ('assistant', 'Assistant'), ('system', 'System')], help_text='Message speaker role.', max_length=16)),
                ('text', models.TextField(help_text='Message content.')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Row creation timestamp.')),
                ('user', models.ForeignKey(help_text='Owner of this message.', on_delete=django.db.models.deletion.CASCADE, related_name='pattern_mitigation_messages', to=settings.AUTH_USER_MODEL)),
                ('plan', models.ForeignKey(help_text='Parent mitigation plan.', on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='core.patternmitigationplan')),
            ],
            options={
                'ordering': ['created_at'],
            },
        ),
        migrations.CreateModel(
            name='PatternMitigationGame',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Stable identifier for this game.', primary_key=True, serialize=False)),
                ('title', models.CharField(help_text='Game title.', max_length=255)),
                ('instructions', models.TextField(blank=True, default='', help_text='Gameplay/instruction text.')),
                ('enabled', models.BooleanField(default=True, help_text='Whether this game is currently enabled.')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Row creation timestamp.')),
                ('user', models.ForeignKey(help_text='Owner of this game.', on_delete=django.db.models.deletion.CASCADE, related_name='pattern_mitigation_games', to=settings.AUTH_USER_MODEL)),
                ('plan', models.ForeignKey(help_text='Parent mitigation plan.', on_delete=django.db.models.deletion.CASCADE, related_name='games', to='core.patternmitigationplan')),
            ],
        ),
        migrations.CreateModel(
            name='PatternArtifactExport',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Stable identifier for this export artifact.', primary_key=True, serialize=False)),
                ('artifact_type', models.CharField(choices=[('rulebook', 'Rulebook'), ('rules', 'Rules'), ('games', 'Games')], help_text='Artifact category being exported.', max_length=32)),
                ('export_format', models.CharField(choices=[('markdown', 'Markdown'), ('json', 'JSON'), ('text', 'Text')], default='markdown', help_text='Serialized output format.', max_length=16)),
                ('protocol_version', models.CharField(default='artifact-v1', help_text='Artifact export protocol version.', max_length=32)),
                ('payload', models.TextField(blank=True, default='', help_text='Serialized artifact body/content.')),
                ('meta', models.JSONField(blank=True, default=dict, help_text='Additional export metadata (counts, hints, source IDs).')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Row creation timestamp.')),
                ('user', models.ForeignKey(help_text='Owner of this export artifact.', on_delete=django.db.models.deletion.CASCADE, related_name='pattern_artifact_exports', to=settings.AUTH_USER_MODEL)),
                ('plan', models.ForeignKey(help_text='Source mitigation plan.', on_delete=django.db.models.deletion.CASCADE, related_name='exports', to='core.patternmitigationplan')),
            ],
        ),
        migrations.CreateModel(
            name='PatternMitigationRule',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Stable identifier for this rule.', primary_key=True, serialize=False)),
                ('title', models.CharField(help_text='Rule title.', max_length=255)),
                ('content', models.TextField(blank=True, default='', help_text='Rule definition/details.')),
                ('enabled', models.BooleanField(default=True, help_text='Whether this rule is currently enabled.')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Row creation timestamp.')),
                ('plan', models.ForeignKey(help_text='Parent mitigation plan.', on_delete=django.db.models.deletion.CASCADE, related_name='rules', to='core.patternmitigationplan')),
                ('user', models.ForeignKey(help_text='Owner of this rule.', on_delete=django.db.models.deletion.CASCADE, related_name='pattern_mitigation_rules', to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
