# Generated by Django 5.2.7 on 2026-06-19 14:38

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ProblemCase',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=160, verbose_name='judul kasus')),
                ('description', models.TextField(verbose_name='deskripsi masalah')),
                ('business_area', models.CharField(choices=[('sales', 'Penjualan'), ('operations', 'Operasional'), ('finance', 'Keuangan'), ('marketing', 'Marketing'), ('product', 'Produk/Layanan'), ('people', 'Tim & SDM'), ('other', 'Lainnya')], default='sales', max_length=32, verbose_name='area bisnis')),
                ('urgency', models.PositiveSmallIntegerField(default=3, verbose_name='urgensi')),
                ('priority_score', models.PositiveSmallIntegerField(default=0, verbose_name='skor prioritas')),
                ('financial_impact', models.CharField(default='Sedang', max_length=32, verbose_name='dampak finansial')),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('analyzed', 'Sudah dianalisis')], default='draft', max_length=20)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Problem Case',
                'verbose_name_plural': 'Problem Cases',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='RootCause',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('factor', models.CharField(max_length=120)),
                ('contribution_score', models.PositiveSmallIntegerField(default=70)),
                ('why_chain', models.TextField()),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='core.rootcause')),
                ('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='root_causes', to='core.problemcase')),
            ],
            options={
                'ordering': ['-contribution_score', 'factor'],
            },
        ),
        migrations.CreateModel(
            name='SolutionOption',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=160)),
                ('impact', models.PositiveSmallIntegerField(default=70)),
                ('efficiency', models.PositiveSmallIntegerField(default=70)),
                ('speed', models.PositiveSmallIntegerField(default=70)),
                ('low_risk', models.PositiveSmallIntegerField(default=70)),
                ('decision_score', models.DecimalField(decimal_places=2, default=0, max_digits=5)),
                ('success_rate', models.PositiveSmallIntegerField(default=70)),
                ('rank', models.PositiveSmallIntegerField(default=1)),
                ('rationale', models.TextField()),
                ('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='solutions', to='core.problemcase')),
            ],
            options={
                'ordering': ['rank', '-decision_score'],
            },
        ),
        migrations.CreateModel(
            name='ActionPlanStep',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('day_index', models.PositiveSmallIntegerField()),
                ('title', models.CharField(max_length=120)),
                ('task', models.TextField()),
                ('is_done', models.BooleanField(default=False)),
                ('solution', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='action_steps', to='core.solutionoption')),
            ],
            options={
                'ordering': ['day_index'],
            },
        ),
    ]
