# Generated by Django 4.1.1 on 2024-03-01 14:35

from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomUser',
            fields=[
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('umpire_code', models.CharField(blank=True, max_length=50, null=True)),
                ('phone', models.CharField(blank=True, max_length=15, null=True)),
                ('first_name', models.CharField(max_length=50)),
                ('last_name', models.CharField(max_length=50)),
                ('licence_id', models.CharField(blank=True, max_length=10, null=True)),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Club',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=50)),
                ('acronym', models.CharField(max_length=10)),
                ('phone', models.CharField(blank=True, max_length=15, null=True)),
                ('code', models.CharField(blank=True, max_length=10, null=True)),
                ('federal_club_data', models.JSONField(blank=True, null=True)),
                ('address', models.CharField(blank=True, max_length=200, null=True)),
                ('city', models.CharField(blank=True, max_length=100, null=True)),
                ('zip_code', models.CharField(blank=True, max_length=10, null=True)),
                ('latitude', models.FloatField(blank=True, null=True)),
                ('longitude', models.FloatField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('date', models.DateField()),
                ('name', models.CharField(blank=True, max_length=200, null=True)),
                ('federal_tournament_data', models.JSONField(blank=True, null=True)),
                ('court_count', models.IntegerField(blank=True, null=True)),
                ('tenup_id', models.IntegerField(blank=True, null=True)),
                ('group_stage_format', models.IntegerField(blank=True, null=True)),
                ('round_format', models.IntegerField(blank=True, null=True)),
                ('loser_round_format', models.IntegerField(blank=True, null=True)),
                ('club', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.club')),
            ],
        ),
        migrations.CreateModel(
            name='GroupStage',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('index', models.IntegerField(blank=True, null=True)),
                ('format', models.IntegerField(blank=True, null=True)),
                ('tournament', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.club')),
            ],
        ),
        migrations.CreateModel(
            name='Match',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('index', models.IntegerField(blank=True, null=True)),
                ('format', models.IntegerField(blank=True, null=True)),
                ('court', models.IntegerField(blank=True, null=True)),
                ('start_date', models.DateField(blank=True, null=True)),
                ('end_date', models.DateField(blank=True, null=True)),
                ('serve_team_id', models.UUIDField(blank=True, null=True)),
                ('winning_team_id', models.UUIDField(blank=True, null=True)),
                ('loser_team_id', models.UUIDField(blank=True, null=True)),
                ('group_stage', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.groupstage')),
            ],
        ),
        migrations.CreateModel(
            name='Tournament',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=200, null=True)),
                ('start_date', models.DateField()),
                ('end_date', models.DateField(blank=True, null=True)),
                ('creation_date', models.DateField()),
                ('is_private', models.BooleanField()),
                ('format', models.IntegerField(blank=True, null=True)),
                ('group_stage_format', models.IntegerField(blank=True, null=True)),
                ('round_format', models.IntegerField(blank=True, null=True)),
                ('loser_round_format', models.IntegerField(blank=True, null=True)),
                ('bracket_sort_mode', models.IntegerField()),
                ('group_stage_count', models.IntegerField()),
                ('rank_source_date', models.DateField(blank=True, null=True)),
                ('custom_name', models.CharField(blank=True, max_length=100, null=True)),
                ('day_duration', models.IntegerField()),
                ('team_count', models.IntegerField()),
                ('team_sorting', models.IntegerField()),
                ('federal_category', models.IntegerField()),
                ('federal_level_category', models.IntegerField()),
                ('federal_age_category', models.IntegerField()),
                ('group_stage_court_count', models.IntegerField(blank=True, null=True)),
                ('seed_count', models.IntegerField()),
                ('closed_registration_date', models.DateField(blank=True, null=True)),
                ('additional_qualified', models.IntegerField()),
                ('court_count', models.IntegerField(blank=True, null=True)),
                ('prioritize_club_members', models.BooleanField()),
                ('qualified_per_group_stage', models.IntegerField()),
                ('teams_per_group_stage', models.IntegerField()),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.event')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='TeamState',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('score', models.CharField(max_length=200)),
                ('walk_out', models.IntegerField(blank=True, null=True)),
                ('lucky_loser', models.BooleanField()),
                ('match', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.match')),
            ],
        ),
        migrations.CreateModel(
            name='TeamRegistration',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('registration_date', models.DateField(blank=True, null=True)),
                ('call_date', models.DateField(blank=True, null=True)),
                ('initial_position', models.IntegerField(blank=True, null=True)),
                ('group_stage_position', models.IntegerField(blank=True, null=True)),
                ('logo', models.CharField(blank=True, max_length=200, null=True)),
                ('group_stage', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.groupstage')),
                ('tournament', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.tournament')),
            ],
        ),
        migrations.CreateModel(
            name='Round',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('index', models.IntegerField(blank=True, null=True)),
                ('format', models.IntegerField(blank=True, null=True)),
                ('loser', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.round')),
                ('tournament', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.club')),
            ],
        ),
        migrations.CreateModel(
            name='PlayerRegistration',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('first_name', models.CharField(max_length=200)),
                ('last_name', models.CharField(max_length=200)),
                ('licence_id', models.CharField(max_length=200)),
                ('rank', models.IntegerField(blank=True, null=True)),
                ('has_paid', models.BooleanField()),
                ('team_registration', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.teamregistration')),
                ('team_state', models.ManyToManyField(to='tournaments.teamstate')),
            ],
        ),
        migrations.AddField(
            model_name='match',
            name='round',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tournaments.round'),
        ),
        migrations.AddField(
            model_name='customuser',
            name='clubs',
            field=models.ManyToManyField(to='tournaments.club'),
        ),
        migrations.AddField(
            model_name='customuser',
            name='groups',
            field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups'),
        ),
        migrations.AddField(
            model_name='customuser',
            name='user_permissions',
            field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions'),
        ),
    ]
