from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [("staff", "0001_initial")]

    operations = [
        migrations.AlterField(
            model_name="staffmember",
            name="specialty",
            field=models.CharField(
                choices=[
                    ("HEAD_COACH", "Head Coach"),
                    ("ASSISTANT_COACH", "Assistant Coach"),
                    ("FITNESS_COACH", "Fitness Coach"),
                    ("GOALKEEPER_COACH", "Goalkeeper Coach"),
                    ("ANALYST", "Analyst"),
                ],
                max_length=24,
            ),
        ),
        migrations.AlterField(
            model_name="clubstaffassignment",
            name="role",
            field=models.CharField(
                choices=[
                    ("HEAD_COACH", "Head Coach"),
                    ("ASSISTANT_COACH", "Assistant Coach"),
                    ("FITNESS_COACH", "Fitness Coach"),
                    ("GOALKEEPER_COACH", "Goalkeeper Coach"),
                    ("ANALYST", "Analyst"),
                ],
                max_length=24,
            ),
        ),
        migrations.RemoveConstraint(model_name="staffmember", name="staff_valid_specialty"),
        migrations.RemoveConstraint(model_name="staffmember", name="staff_source_specialty_ok"),
        migrations.RemoveConstraint(model_name="clubstaffassignment", name="staff_assign_valid_role"),
        migrations.AddConstraint(
            model_name="staffmember",
            constraint=models.CheckConstraint(
                condition=models.Q(specialty__in=["HEAD_COACH", "ASSISTANT_COACH", "FITNESS_COACH", "GOALKEEPER_COACH", "ANALYST"]),
                name="staff_valid_specialty",
            ),
        ),
        migrations.AddConstraint(
            model_name="staffmember",
            constraint=models.CheckConstraint(
                condition=(
                    models.Q(source_type="CAREER", specialty="HEAD_COACH", coach_career__isnull=False)
                    | models.Q(source_type="NPC", specialty__in=["ASSISTANT_COACH", "FITNESS_COACH", "GOALKEEPER_COACH", "ANALYST"], coach_career__isnull=True)
                ),
                name="staff_source_specialty_ok",
            ),
        ),
        migrations.AddConstraint(
            model_name="clubstaffassignment",
            constraint=models.CheckConstraint(
                condition=models.Q(role__in=["HEAD_COACH", "ASSISTANT_COACH", "FITNESS_COACH", "GOALKEEPER_COACH", "ANALYST"]),
                name="staff_assign_valid_role",
            ),
        ),
    ]
