# Generated by Django 6.0 on 2026-03-04 23:59

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('academics', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Student',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('student_id', models.CharField(help_text='Unique identifier for the student (e.g., 2025-001)', max_length=20, unique=True, verbose_name='Student ID')),
                ('first_name', models.CharField(max_length=100, verbose_name='First Name')),
                ('last_name', models.CharField(max_length=100, verbose_name='Last Name')),
                ('date_of_birth', models.DateField(blank=True, default=None, null=True, verbose_name='Date of Birth')),
                ('place_of_birth', models.CharField(blank=True, max_length=100, null=True, verbose_name='Place of Birth')),
                ('gender', models.CharField(blank=True, choices=[('M', 'Male'), ('F', 'Female'), ('U', 'Unknown/Unspecified')], default='U', max_length=1, verbose_name='Gender')),
                ('nationality', models.CharField(blank=True, default='Cameroonian', max_length=50, verbose_name='Nationality')),
                ('home_address', models.TextField(blank=True, verbose_name='Home Address')),
                ('quarter', models.CharField(blank=True, help_text='e.g., Bonapriso, Akwa, Bonanjo', max_length=100, verbose_name='Quarter/Neighborhood')),
                ('city', models.CharField(blank=True, default='Douala', max_length=100, verbose_name='City')),
                ('phone_number', models.CharField(blank=True, max_length=17, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+237XXXXXXXXX'.", regex='^\\+?[1-9]\\d{1,14}$')], verbose_name='Phone Number')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='Email Address')),
                ('emergency_contact_name', models.CharField(blank=True, max_length=100, verbose_name='Emergency Contact Name')),
                ('emergency_contact_phone', models.CharField(blank=True, max_length=17, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+237XXXXXXXXX'.", regex='^\\+?[1-9]\\d{1,14}$')], verbose_name='Emergency Contact Phone')),
                ('emergency_contact_relationship', models.CharField(blank=True, help_text='e.g., Father, Mother, Guardian', max_length=50, verbose_name='Relationship')),
                ('blood_group', models.CharField(blank=True, choices=[('A+', 'A+'), ('A-', 'A-'), ('B+', 'B+'), ('B-', 'B-'), ('AB+', 'AB+'), ('AB-', 'AB-'), ('O+', 'O+'), ('O-', 'O-'), ('unknown', 'Unknown')], default='unknown', max_length=7, verbose_name='Blood Group')),
                ('allergies', models.TextField(blank=True, help_text='List any allergies the student has', verbose_name='Allergies')),
                ('chronic_conditions', models.TextField(blank=True, help_text='List any chronic medical conditions', verbose_name='Chronic Conditions')),
                ('medications', models.TextField(blank=True, help_text='List any medications the student is taking', verbose_name='Current Medications')),
                ('admission_date', models.DateField(blank=True, null=True, verbose_name='Admission Date')),
                ('admission_class', models.CharField(blank=True, choices=[('pre_nursery', 'Pre-Nursery'), ('nursery1', 'Nursery 1'), ('nursery2', 'Nursery 2'), ('moyenne_section', 'Moyenne Section'), ('grande_section', 'Grande Section'), ('sil', 'SIL'), ('cp', 'CP'), ('ce1', 'CE1'), ('ce2', 'CE2'), ('cm1', 'CM1'), ('cm2', 'CM2'), ('class1', 'Class 1'), ('class2', 'Class 2'), ('class3', 'Class 3'), ('class4', 'Class 4'), ('class5', 'Class 5'), ('class6', 'Class 6')], max_length=20, verbose_name='Admission Class')),
                ('status', models.CharField(choices=[('active', 'Active'), ('inactive', 'Inactive'), ('graduated', 'Graduated'), ('transferred', 'Transferred'), ('suspended', 'Suspended'), ('withdrawn', 'Withdrawn')], default='active', max_length=20, verbose_name='Status')),
                ('photo', models.ImageField(blank=True, null=True, upload_to='student_photos/', verbose_name='Student Photo')),
                ('birth_certificate', models.FileField(blank=True, null=True, upload_to='documents/birth_certificates/', verbose_name='Birth Certificate')),
                ('imported_from', models.CharField(blank=True, help_text="Source of import (e.g., 'Class 6 Excel')", max_length=100, null=True)),
                ('original_data', models.JSONField(blank=True, help_text='Original imported data as JSON', null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, null=True, verbose_name='Updated At')),
                ('notes', models.TextField(blank=True, verbose_name='Additional Notes')),
                ('current_class', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='students', to='academics.schoolclass', verbose_name='Current Class')),
            ],
            options={
                'verbose_name': 'Student',
                'verbose_name_plural': 'Students',
                'ordering': ['student_id', 'last_name', 'first_name'],
            },
        ),
        migrations.CreateModel(
            name='ParentGuardian',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=100, verbose_name='First Name')),
                ('last_name', models.CharField(max_length=100, verbose_name='Last Name')),
                ('relationship', models.CharField(choices=[('father', 'Father'), ('mother', 'Mother'), ('guardian', 'Guardian'), ('grandparent', 'Grandparent'), ('sibling', 'Sibling'), ('aunt', 'Aunt'), ('uncle', 'Uncle'), ('other', 'Other')], max_length=20, verbose_name='Relationship to Student')),
                ('phone', models.CharField(max_length=17, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+237XXXXXXXXX'.", regex='^\\+?[1-9]\\d{1,14}$')], verbose_name='Phone Number')),
                ('alternate_phone', models.CharField(blank=True, max_length=17, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+237XXXXXXXXX'.", regex='^\\+?[1-9]\\d{1,14}$')], verbose_name='Alternate Phone Number')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='Email Address')),
                ('address', models.TextField(blank=True, verbose_name='Address')),
                ('occupation', models.CharField(blank=True, choices=[('teacher', 'Teacher'), ('nurse', 'Nurse'), ('engineer', 'Engineer'), ('doctor', 'Doctor'), ('lawyer', 'Lawyer'), ('business', 'Business Owner'), ('civil_servant', 'Civil Servant'), ('farmer', 'Farmer'), ('driver', 'Driver'), ('trader', 'Trader'), ('housewife', 'Housewife'), ('other', 'Other')], max_length=50, verbose_name='Occupation')),
                ('employer', models.CharField(blank=True, max_length=100, verbose_name='Employer')),
                ('education_level', models.CharField(blank=True, choices=[('none', 'No Formal Education'), ('primary', 'Primary School'), ('secondary', 'Secondary School'), ('high_school', 'High School'), ('university', 'University'), ('postgraduate', 'Postgraduate')], max_length=20, verbose_name='Education Level')),
                ('mobile_money_number', models.CharField(blank=True, max_length=20, verbose_name='Mobile Money Number')),
                ('mobile_money_provider', models.CharField(choices=[('mtn', 'MTN Mobile Money'), ('orange', 'Orange Money'), ('none', 'None')], default='none', max_length=10, verbose_name='Mobile Money Provider')),
                ('preferred_language', models.CharField(choices=[('fr', 'French'), ('en', 'English'), ('both', 'Both')], default='fr', max_length=10, verbose_name='Preferred Language')),
                ('receive_sms', models.BooleanField(default=True, verbose_name='Receive SMS Notifications')),
                ('receive_email', models.BooleanField(default=False, verbose_name='Receive Email Notifications')),
                ('receive_whatsapp', models.BooleanField(default=True, verbose_name='Receive WhatsApp Messages')),
                ('is_primary_contact', models.BooleanField(default=False, help_text='Is this the primary contact for the student?', verbose_name='Primary Contact')),
                ('can_pick_up', models.BooleanField(default=True, help_text='Is this person authorized to pick up the student from school?', verbose_name='Can Pick Up Student')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')),
                ('notes', models.TextField(blank=True, verbose_name='Additional Notes')),
                ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='parents', to='students.student', verbose_name='Student')),
            ],
            options={
                'verbose_name': 'Parent/Guardian',
                'verbose_name_plural': 'Parents/Guardians',
                'ordering': ['student', '-is_primary_contact', 'last_name', 'first_name'],
            },
        ),
        migrations.AddIndex(
            model_name='student',
            index=models.Index(fields=['student_id'], name='students_st_student_e7126a_idx'),
        ),
        migrations.AddIndex(
            model_name='student',
            index=models.Index(fields=['last_name', 'first_name'], name='students_st_last_na_3e473b_idx'),
        ),
        migrations.AddIndex(
            model_name='student',
            index=models.Index(fields=['current_class'], name='students_st_current_ad0594_idx'),
        ),
        migrations.AddIndex(
            model_name='student',
            index=models.Index(fields=['status'], name='students_st_status_5e2210_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='parentguardian',
            unique_together={('student', 'phone')},
        ),
    ]
