# Generated by Django 2.1.5 on 2019-05-05 14:37

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Match',
            fields=[
                ('match_id', models.AutoField(primary_key=True, serialize=False)),
                ('startDT', models.DateTimeField(blank=True, default=None, null=True, verbose_name='Start Time')),
                ('onGoing', models.BooleanField(default=False, verbose_name='Match in Progress')),
                ('endDT', models.DateTimeField(blank=True, default=None, null=True, verbose_name='End Time')),
                ('umpire', models.CharField(default=None, max_length=64, null=True, verbose_name='Umpire')),
                ('court_num', models.PositiveSmallIntegerField(default=1, null=True, validators=[django.core.validators.MinValueValidator(1)], verbose_name='Court ID')),
            ],
        ),
        migrations.CreateModel(
            name='Player',
            fields=[
                ('player_id', models.AutoField(primary_key=True, serialize=False)),
                ('last_name', models.CharField(max_length=64, null=True, verbose_name='Last Name')),
                ('first_name', models.CharField(max_length=64, null=True, verbose_name='First Name')),
                ('player_level', models.PositiveSmallIntegerField(default=0, null=True, verbose_name='Level')),
                ('total_games', models.PositiveSmallIntegerField(default=0, null=True, verbose_name='Game Count')),
                ('total_wins', models.PositiveSmallIntegerField(default=0, null=True, verbose_name='Total Wins')),
                ('inQueue', models.BooleanField(default=False, verbose_name='Currently in Queue')),
                ('inMatch', models.BooleanField(default=False, verbose_name='Currently in Match')),
                ('user', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'player',
            },
        ),
        migrations.CreateModel(
            name='Queue',
            fields=[
                ('queue_id', models.AutoField(primary_key=True, serialize=False)),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Date Created')),
                ('match_type', models.CharField(choices=[('S', 'Singles'), ('D', 'Doubles')], default='S', max_length=1, verbose_name='Match Type')),
                ('court', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1)], verbose_name='Number of Courts')),
                ('onGoing', models.BooleanField(default=True, verbose_name='Queue in Progress')),
                ('players', models.ManyToManyField(related_name='queues', to='queues.Player', verbose_name='Players in Queue')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Winner',
            fields=[
                ('winner_id', models.AutoField(primary_key=True, serialize=False)),
                ('match', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='queues.Match')),
                ('players', models.ManyToManyField(to='queues.Player')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='match',
            name='players',
            field=models.ManyToManyField(to='queues.Player', verbose_name='Players in Match'),
        ),
        migrations.AddField(
            model_name='match',
            name='queuedAt',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='queues.Queue', verbose_name='Queued at'),
        ),
        migrations.AddField(
            model_name='match',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterUniqueTogether(
            name='player',
            unique_together={('first_name', 'last_name')},
        ),
    ]
