# Generated by Django 4.2.9 on 2026-02-26 11:17

from decimal import Decimal
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    dependencies = [
        ('app', '0072_schoolsetting_offers_primary_and_more'),
        ('secondary', '0001_initial'),
    ]

    operations = [
        migrations.AlterField(
            model_name='secondarycomputationpolicy',
            name='level',
            field=models.CharField(choices=[('LOWER_SECONDARY', 'Lower Secondary (S1-S4)'), ('UPPER_SECONDARY', 'Upper Secondary (S5-S6 / A-Level)')], default='LOWER_SECONDARY', max_length=30),
        ),
        migrations.AlterField(
            model_name='unebsubmissionbatch',
            name='level',
            field=models.CharField(choices=[('LOWER_SECONDARY', 'Lower Secondary (S1-S4)'), ('UPPER_SECONDARY', 'Upper Secondary (S5-S6 / A-Level)')], default='LOWER_SECONDARY', max_length=30),
        ),
        migrations.CreateModel(
            name='ALevelSubjectModule',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=30)),
                ('name', models.CharField(max_length=120)),
                ('module_order', models.PositiveSmallIntegerField(default=1)),
                ('is_active', models.BooleanField(default=True)),
                ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='a_level_modules', to='app.subject')),
            ],
            options={
                'db_table': 'app_alevelsubjectmodule',
                'ordering': ['subject_id', 'module_order', 'code'],
                'unique_together': {('subject', 'code')},
            },
        ),
        migrations.CreateModel(
            name='ALevelModuleAssessment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('component_type', models.CharField(choices=[('SBA', 'School-Based Assessment'), ('MODULAR_EXAM', 'Modular Exam'), ('PRACTICAL_PROJECT', 'Practical / Project'), ('CONTEMPORARY_STUDIES', 'Contemporary Studies'), ('OTHER', 'Other')], max_length=40)),
                ('competency_code', models.CharField(choices=[('E', 'Exceeds'), ('M', 'Meets'), ('A', 'Approaching'), ('B', 'Below')], max_length=2)),
                ('points_awarded', models.DecimalField(blank=True, decimal_places=2, max_digits=4, null=True)),
                ('attempt_no', models.PositiveSmallIntegerField(default=1)),
                ('is_retake', models.BooleanField(default=False)),
                ('assessed_on', models.DateField(default=django.utils.timezone.now)),
                ('notes', models.TextField(blank=True, default='')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('module', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='assessments', to='secondary.alevelsubjectmodule')),
                ('policy', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='a_level_assessments', to='secondary.secondarycomputationpolicy')),
                ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='a_level_assessments', to='app.student')),
                ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='a_level_assessments', to='app.subject')),
            ],
            options={
                'db_table': 'app_alevelmoduleassessment',
                'ordering': ['student_id', 'subject_id', 'component_type', 'module_id', '-attempt_no', '-assessed_on'],
                'unique_together': {('student', 'subject', 'module', 'component_type', 'attempt_no')},
            },
        ),
        migrations.CreateModel(
            name='ALevelComponentWeight',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('component_type', models.CharField(choices=[('SBA', 'School-Based Assessment'), ('MODULAR_EXAM', 'Modular Exam'), ('PRACTICAL_PROJECT', 'Practical / Project'), ('CONTEMPORARY_STUDIES', 'Contemporary Studies'), ('OTHER', 'Other')], max_length=40)),
                ('weight', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=5)),
                ('is_required', models.BooleanField(default=True)),
                ('policy', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='a_level_component_weights', to='secondary.secondarycomputationpolicy')),
                ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='a_level_component_weights', to='app.subject')),
            ],
            options={
                'db_table': 'app_alevelcomponentweight',
                'ordering': ['subject_id', 'component_type'],
                'unique_together': {('policy', 'subject', 'component_type')},
            },
        ),
        migrations.CreateModel(
            name='ALevelCompetencyScale',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(choices=[('E', 'Exceeds'), ('M', 'Meets'), ('A', 'Approaching'), ('B', 'Below')], max_length=2)),
                ('descriptor', models.CharField(max_length=120)),
                ('point_value', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=4)),
                ('min_weighted_point', models.DecimalField(decimal_places=2, max_digits=4)),
                ('max_weighted_point', models.DecimalField(decimal_places=2, max_digits=4)),
                ('display_order', models.PositiveSmallIntegerField(default=0)),
                ('policy', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='a_level_scales', to='secondary.secondarycomputationpolicy')),
            ],
            options={
                'db_table': 'app_alevelcompetencyscale',
                'ordering': ['display_order', '-point_value'],
                'unique_together': {('policy', 'code')},
            },
        ),
    ]
