# Generated by Django 5.2.13 on 2026-04-28 09:53

import apps.core.storage.paths
import django.db.models.deletion
import simple_history.models
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("alumni_profiles", "0002_alumniprofile_mentor_accepting_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalSpotlight",
            fields=[
                (
                    "id",
                    models.BigIntegerField(
                        auto_created=True, blank=True, db_index=True, verbose_name="ID"
                    ),
                ),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("partner_of_year", "Partner of the Year"),
                            ("mentor_of_month", "Mentor of the Month"),
                            ("innovator", "Innovator spotlight"),
                            ("newsletter", "Newsletter feature"),
                        ],
                        max_length=24,
                    ),
                ),
                ("title", models.CharField(max_length=200)),
                (
                    "citation",
                    models.TextField(
                        help_text="Curator's writeup of why this alumna/us is being recognised."
                    ),
                ),
                ("cover_image", models.TextField(blank=True, max_length=100, null=True)),
                (
                    "period_label",
                    models.CharField(
                        db_index=True,
                        help_text="Reporting period, e.g. '2026' or '2026-04'.",
                        max_length=16,
                    ),
                ),
                ("featured_from", models.DateField()),
                ("featured_until", models.DateField()),
                ("is_active", models.BooleanField(db_index=True, default=True)),
                ("created_at", models.DateTimeField(blank=True, editable=False)),
                ("history_id", models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField(db_index=True)),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")], max_length=1
                    ),
                ),
                (
                    "curated_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "nominated_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "profile",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="alumni_profiles.alumniprofile",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical spotlight",
                "verbose_name_plural": "historical spotlights",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": ("history_date", "history_id"),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="Endorsement",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("partner_of_year", "Partner of the Year"),
                            ("mentor_of_month", "Mentor of the Month"),
                            ("innovator", "Innovator spotlight"),
                            ("newsletter", "Newsletter feature"),
                        ],
                        max_length=24,
                    ),
                ),
                ("citation", models.CharField(blank=True, max_length=400)),
                ("period_label", models.CharField(db_index=True, max_length=16)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "endorser",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="alumni_endorsements_given",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "profile",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="endorsements_received",
                        to="alumni_profiles.alumniprofile",
                    ),
                ),
            ],
            options={
                "ordering": ["-created_at"],
                "constraints": [
                    models.UniqueConstraint(
                        fields=("profile", "endorser", "category", "period_label"),
                        name="uniq_endorsement_per_period",
                    )
                ],
            },
        ),
        migrations.CreateModel(
            name="Spotlight",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("partner_of_year", "Partner of the Year"),
                            ("mentor_of_month", "Mentor of the Month"),
                            ("innovator", "Innovator spotlight"),
                            ("newsletter", "Newsletter feature"),
                        ],
                        max_length=24,
                    ),
                ),
                ("title", models.CharField(max_length=200)),
                (
                    "citation",
                    models.TextField(
                        help_text="Curator's writeup of why this alumna/us is being recognised."
                    ),
                ),
                (
                    "cover_image",
                    models.FileField(
                        blank=True,
                        null=True,
                        upload_to=apps.core.storage.paths.upload_to_alumni_photos,
                    ),
                ),
                (
                    "period_label",
                    models.CharField(
                        db_index=True,
                        help_text="Reporting period, e.g. '2026' or '2026-04'.",
                        max_length=16,
                    ),
                ),
                ("featured_from", models.DateField()),
                ("featured_until", models.DateField()),
                ("is_active", models.BooleanField(db_index=True, default=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "curated_by",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="alumni_spotlights_curated",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "nominated_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="alumni_spotlights_nominated",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "profile",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="spotlights",
                        to="alumni_profiles.alumniprofile",
                    ),
                ),
            ],
            options={
                "ordering": ["-featured_from"],
                "indexes": [
                    models.Index(
                        fields=["is_active", "featured_from"], name="alumni_reco_is_acti_c6e6ba_idx"
                    )
                ],
                "constraints": [
                    models.UniqueConstraint(
                        fields=("category", "period_label"),
                        name="uniq_spotlight_per_category_period",
                    )
                ],
            },
        ),
    ]
