from django.db import migrations, models
import django.db.models.deletion
import teacher.utils.study_material_paths


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("academics", "0002_subject_book_document"),
        ("people", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="StudyMaterial",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(max_length=255)),
                ("description", models.TextField(blank=True)),
                ("material_type", models.CharField(
                    choices=[
                        ("NOTES", "Class Notes"),
                        ("TEXTBOOK", "Textbook"),
                        ("REFERENCE", "Reference Material"),
                        ("WORKSHEET", "Worksheet"),
                        ("SYLLABUS", "Syllabus"),
                        ("OTHER", "Other"),
                    ],
                    default="NOTES",
                    max_length=20,
                )),
                ("file", models.FileField(upload_to=teacher.utils.study_material_paths.study_material_upload_path)),
                ("is_active", models.BooleanField(default=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("subject", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="study_materials", to="academics.subject")),
                ("academic_class", models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="study_materials", to="academics.academicclass")),
                ("uploaded_by", models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="uploaded_study_materials", to="people.teacher")),
            ],
            options={"ordering": ["-created_at"]},
        ),
        migrations.CreateModel(
            name="PreviousYearPaper",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(blank=True, max_length=255)),
                ("year", models.PositiveIntegerField(help_text="Year of the exam, e.g. 2023")),
                ("exam_type", models.CharField(
                    choices=[
                        ("ANNUAL", "Annual Exam"),
                        ("HALF_YEARLY", "Half Yearly"),
                        ("QUARTERLY", "Quarterly"),
                        ("MIDTERM", "Mid-Term"),
                        ("UNIT_TEST", "Unit Test"),
                        ("BOARD", "Board Exam"),
                        ("OTHER", "Other"),
                    ],
                    default="ANNUAL",
                    max_length=20,
                )),
                ("file", models.FileField(upload_to=teacher.utils.study_material_paths.previous_year_paper_upload_path)),
                ("is_active", models.BooleanField(default=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("subject", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="previous_year_papers", to="academics.subject")),
                ("standard", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="previous_year_papers", to="academics.standard")),
                ("uploaded_by", models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="uploaded_pyq_papers", to="people.teacher")),
            ],
            options={"ordering": ["-year", "-created_at"]},
        ),
    ]
