# Generated by Django 5.2.17 on 2026-10-07 13:31

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


class Migration(migrations.Migration):

    dependencies = [
        ('exams', '0028_shared_work_queue_and_unassign'),
    ]

    operations = [
        migrations.AddField(
            model_name='studenttask',
            name='pipeline_stage',
            field=models.PositiveSmallIntegerField(blank=True, null=True),
        ),
        migrations.CreateModel(
            name='TaskPipeline',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('paper_code', models.CharField(db_index=True, max_length=60, unique=True)),
                ('current_stage', models.PositiveSmallIntegerField(default=1)),
                ('stages_completed', models.JSONField(blank=True, default=list)),
                ('status', models.CharField(choices=[('ACTIVE', 'Active'), ('BLOCKED_ON_TEACHER', 'Blocked on teacher'), ('DONE', 'Done')], db_index=True, default='ACTIVE', max_length=24)),
                ('started_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('owner_student', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='task_pipelines_owned', to='exams.student')),
            ],
        ),
        migrations.AddField(
            model_name='studenttask',
            name='pipeline',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='stage_tasks', to='exams.taskpipeline'),
        ),
        migrations.AddIndex(
            model_name='taskpipeline',
            index=models.Index(fields=['status', 'current_stage'], name='exams_taskp_status_b19fb4_idx'),
        ),
    ]
