# Generated by Django 6.0.6 on 2026-08-04 11:28

from django.db import migrations, models


def rename_match_to_game(apps, schema_editor):
    Event = apps.get_model('events', 'Event')
    EventSeries = apps.get_model('events', 'EventSeries')
    Event.objects.filter(kind='match').update(kind='game')
    EventSeries.objects.filter(kind='match').update(kind='game')


def rename_game_to_match(apps, schema_editor):
    Event = apps.get_model('events', 'Event')
    EventSeries = apps.get_model('events', 'EventSeries')
    Event.objects.filter(kind='game').update(kind='match')
    EventSeries.objects.filter(kind='game').update(kind='match')


class Migration(migrations.Migration):

    dependencies = [
        ('events', '0013_alter_event_kind_alter_eventseries_kind'),
    ]

    operations = [
        migrations.AddField(
            model_name='event',
            name='competition',
            field=models.CharField(blank=True, help_text='The league, cup or competition this game is part of.', max_length=255, verbose_name='competition'),
        ),
        migrations.AddField(
            model_name='event',
            name='external_game_id',
            field=models.CharField(blank=True, help_text="This game's id in an external competition data source, for automatic score fetching later.", max_length=255, verbose_name='external game ID'),
        ),
        migrations.AddField(
            model_name='event',
            name='is_live',
            field=models.BooleanField(default=False, help_text='The game is currently in progress.', verbose_name='live'),
        ),
        migrations.AddField(
            model_name='event',
            name='score_against',
            field=models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='score (opponent)'),
        ),
        migrations.AddField(
            model_name='event',
            name='score_for',
            field=models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='score (us)'),
        ),
        migrations.AlterField(
            model_name='event',
            name='deadline',
            field=models.DateTimeField(blank=True, null=True, verbose_name='registration deadline'),
        ),
        migrations.AlterField(
            model_name='event',
            name='kind',
            field=models.CharField(choices=[('training', 'Training'), ('game', 'Game'), ('tournament', 'Tournament'), ('meeting', 'Meeting'), ('social', 'Social'), ('other', 'Other')], default='other', max_length=10, verbose_name='kind'),
        ),
        migrations.AlterField(
            model_name='eventseries',
            name='deadline_offset',
            field=models.DurationField(blank=True, help_text="How long before the start each occurrence's registration deadline is.", null=True, verbose_name='registration deadline offset'),
        ),
        migrations.AlterField(
            model_name='eventseries',
            name='kind',
            field=models.CharField(choices=[('training', 'Training'), ('game', 'Game'), ('tournament', 'Tournament'), ('meeting', 'Meeting'), ('social', 'Social'), ('other', 'Other')], default='other', max_length=10, verbose_name='kind'),
        ),
        migrations.RunPython(rename_match_to_game, rename_game_to_match),
    ]
