# Generated by Django 6.0.6 on 2026-08-09 09:25

import django.db.models.deletion
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('club', '0020_sponsor_logo_height_sponsor_logo_width'),
        ('members', '0004_group_groupmembership_and_more'),
        ('teams', '0007_teamphoto'),
    ]

    operations = [
        migrations.CreateModel(
            name='RefereeLevel',
            fields=[
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255, verbose_name='name')),
                ('ordering', models.PositiveSmallIntegerField(default=0, help_text='Lower numbers are listed first. Levels with the same number are ordered by name.', verbose_name='ordering')),
                ('club', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='club.club')),
                ('teams', models.ManyToManyField(blank=True, help_text="Members holding this level can be assigned to referee these teams' home games.", related_name='referee_levels', to='teams.team', verbose_name='qualifies for')),
            ],
            options={
                'verbose_name': 'referee level',
                'verbose_name_plural': 'referee levels',
                'ordering': ['ordering', 'name'],
            },
        ),
        migrations.CreateModel(
            name='RefereeProfile',
            fields=[
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('valid_until', models.DateField(blank=True, help_text="Once this date has passed, the referee is not eligible for assignment until it's extended.", null=True, verbose_name='valid until')),
                ('level', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='referees', to='teams.refereelevel', verbose_name='level')),
                ('member', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='referee_profile', to='members.member', verbose_name='member')),
            ],
            options={
                'verbose_name': 'referee profile',
                'verbose_name_plural': 'referee profiles',
                'ordering': ['member__last_name', 'member__first_name'],
            },
        ),
        migrations.AddConstraint(
            model_name='refereelevel',
            constraint=models.UniqueConstraint(fields=('club', 'name'), name='unique_referee_level_name_per_club'),
        ),
    ]
