# Generated by Django 6.0.6 on 2026-08-08 21:55

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


class Migration(migrations.Migration):

    dependencies = [
        ('events', '0019_competition_sport_type'),
        ('members', '0004_group_groupmembership_and_more'),
    ]

    operations = [
        migrations.AddField(
            model_name='event',
            name='max_referees',
            field=models.PositiveSmallIntegerField(default=2, help_text='How many referees can be assigned to this game. Only meaningful for home games -- ignored otherwise.', verbose_name='max referees'),
        ),
        migrations.CreateModel(
            name='EventReferee',
            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)),
                ('assigned_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='members.member', verbose_name='assigned by')),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='referees', to='events.event', verbose_name='event')),
                ('member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='referee_assignments', to='members.member', verbose_name='member')),
            ],
            options={
                'verbose_name': 'event referee',
                'verbose_name_plural': 'event referees',
                'ordering': ['event', 'member__last_name', 'member__first_name'],
                'constraints': [models.UniqueConstraint(fields=('event', 'member'), name='unique_referee_per_event')],
            },
        ),
    ]
