# Generated by Django 5.0.6 on 2026-06-05 09:18

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Program',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150)),
                ('level', models.CharField(choices=[('junior_certificate', 'Junior Certificate (3 Years)'), ('national_certificate', 'National Certificate (2 Years)'), ('diploma', 'Diploma (2 Years)')], max_length=30)),
                ('duration', models.CharField(max_length=50)),
                ('tuition_fee', models.DecimalField(decimal_places=2, max_digits=12)),
                ('practical_fee', models.DecimalField(decimal_places=2, max_digits=12)),
                ('assessment_fee', models.DecimalField(decimal_places=2, max_digits=12)),
                ('entry_requirement', models.CharField(blank=True, max_length=200)),
                ('description', models.TextField(blank=True)),
                ('is_active', models.BooleanField(default=True)),
            ],
            options={
                'ordering': ['level', 'name'],
            },
        ),
        migrations.CreateModel(
            name='Application',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=100)),
                ('last_name', models.CharField(max_length=100)),
                ('other_names', models.CharField(blank=True, max_length=100)),
                ('date_of_birth', models.DateField()),
                ('gender', models.CharField(choices=[('male', 'Male'), ('female', 'Female'), ('other', 'Other / Prefer not to say')], max_length=10)),
                ('nationality', models.CharField(default='Ugandan', max_length=100)),
                ('national_id', models.CharField(blank=True, max_length=50, verbose_name='National ID / Passport No.')),
                ('phone_number', models.CharField(max_length=20)),
                ('email', models.EmailField(max_length=254)),
                ('physical_address', models.TextField(help_text='Village, Parish, Sub-county')),
                ('district', models.CharField(max_length=100)),
                ('religion', models.CharField(blank=True, max_length=100)),
                ('highest_education_level', models.CharField(choices=[('primary', 'Primary (PLE)'), ('o_level', 'O-Level (UCE)'), ('a_level', 'A-Level (UACE)'), ('certificate', 'Certificate'), ('diploma', 'Diploma'), ('degree', 'Degree or Higher')], max_length=20)),
                ('last_school_attended', models.CharField(max_length=200)),
                ('year_of_completion', models.PositiveIntegerField()),
                ('emergency_contact_name', models.CharField(max_length=200)),
                ('emergency_contact_relationship', models.CharField(choices=[('parent', 'Parent'), ('guardian', 'Guardian'), ('sibling', 'Sibling'), ('spouse', 'Spouse'), ('relative', 'Other Relative'), ('friend', 'Friend')], max_length=20)),
                ('emergency_contact_phone', models.CharField(max_length=20)),
                ('emergency_contact_email', models.EmailField(blank=True, max_length=254)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('under_review', 'Under Review'), ('approved', 'Approved'), ('rejected', 'Rejected')], default='pending', max_length=20)),
                ('admin_notes', models.TextField(blank=True, help_text='Internal notes (not sent to applicant)')),
                ('rejection_reason', models.TextField(blank=True, help_text='Reason sent to applicant on rejection')),
                ('submitted_at', models.DateTimeField(auto_now_add=True)),
                ('reviewed_at', models.DateTimeField(blank=True, null=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('applicant_user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='application', to=settings.AUTH_USER_MODEL)),
                ('reviewed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_applications', to=settings.AUTH_USER_MODEL)),
                ('program_applied', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='applications', to='admissions.program')),
            ],
            options={
                'ordering': ['-submitted_at'],
            },
        ),
        migrations.CreateModel(
            name='Enrollment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('student_number', models.CharField(blank=True, max_length=20, unique=True)),
                ('enrolled_at', models.DateTimeField(auto_now_add=True)),
                ('is_active', models.BooleanField(default=True)),
                ('application', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, related_name='enrollment', to='admissions.application')),
                ('student', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='enrollment', to=settings.AUTH_USER_MODEL)),
                ('program', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='enrollments', to='admissions.program')),
            ],
            options={
                'ordering': ['-enrolled_at'],
            },
        ),
        migrations.CreateModel(
            name='ApplicationDocument',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('document_type', models.CharField(choices=[('o_level_results', 'O-Level Results (UCE)'), ('a_level_results', 'A-Level Results (UACE)'), ('certificate', 'Certificate'), ('national_id', 'National ID / Passport Copy'), ('passport_photo', 'Passport-size Photo')], max_length=50)),
                ('file', models.FileField(upload_to='application_documents/%Y/%m/')),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
                ('is_verified', models.BooleanField(default=False)),
                ('application', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='documents', to='admissions.application')),
            ],
            options={
                'unique_together': {('application', 'document_type')},
            },
        ),
    ]
