# Generated by Django 5.2.3 on 2025-10-11 14:57

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('problem', '0004_problem_allow_flowchart_problem_flowchart_data_and_more'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='FlowchartSubmission',
            fields=[
                ('id', models.TextField(db_index=True, default=utils.shortcuts.rand_str, primary_key=True, serialize=False)),
                ('mermaid_code', models.TextField()),
                ('flowchart_data', models.JSONField(default=dict)),
                ('status', models.IntegerField(default=0)),
                ('create_time', models.DateTimeField(auto_now_add=True)),
                ('ai_score', models.FloatField(blank=True, null=True)),
                ('ai_grade', models.CharField(blank=True, max_length=10, null=True)),
                ('ai_feedback', models.TextField(blank=True, null=True)),
                ('ai_suggestions', models.TextField(blank=True, null=True)),
                ('ai_criteria_details', models.JSONField(default=dict)),
                ('ai_provider', models.CharField(default='deepseek', max_length=50)),
                ('ai_model', models.CharField(default='deepseek-chat', max_length=50)),
                ('processing_time', models.FloatField(blank=True, null=True)),
                ('evaluation_time', models.DateTimeField(blank=True, null=True)),
                ('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='flowchart_submissions', to='problem.problem')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='flowchart_submissions', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'flowchart_submission',
                'ordering': ['-create_time'],
                'indexes': [models.Index(fields=['user', 'create_time'], name='flowchart_user_time_idx'), models.Index(fields=['problem', 'create_time'], name='flowchart_problem_time_idx'), models.Index(fields=['status'], name='flowchart_status_idx')],
            },
        ),
    ]
