# Generated by Django 3.1.2 on 2020-11-01 13:58

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
                ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('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')),
                ('matchday', models.IntegerField(default=1)),
                ('season', models.IntegerField(default=2020)),
                ('current_season', models.IntegerField(default=2020)),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Club',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='ClubAttr',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('rank', models.IntegerField(default=20)),
                ('budget', models.DecimalField(decimal_places=2, default=15.0, max_digits=5)),
                ('ovr', models.IntegerField(help_text='Value between 1 and 20')),
                ('formation', models.CharField(default='4-4-2', max_length=5)),
                ('attendance', models.DecimalField(decimal_places=2, default=0.5, max_digits=3)),
                ('pld', models.IntegerField(default=0)),
                ('gs', models.IntegerField(default=0)),
                ('ga', models.IntegerField(default=0)),
                ('pts', models.IntegerField(default=0)),
                ('pos', models.IntegerField(default=0)),
                ('pos_track', models.IntegerField(default=20)),
            ],
        ),
        migrations.CreateModel(
            name='ClubInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Enter your team name.', max_length=50, unique=True)),
                ('primary_colour', models.CharField(default='#2E86C1', help_text='Enter primary team colour (RGB, RGBA or HEX).', max_length=25)),
                ('secondary_colour', models.CharField(default='#FFC300', help_text='Enter secondary team colour (RGB, RGBA or HEX).', max_length=25)),
                ('desc', models.TextField(default='Can you transform these plucky underdogs into world beaters?', max_length=100)),
                ('capacity', models.IntegerField(default=22000)),
                ('user_club', models.BooleanField(default=False)),
                ('rivals', models.ManyToManyField(blank=True, default=12, to='main.ClubInfo')),
            ],
        ),
        migrations.CreateModel(
            name='Fixture',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('season', models.IntegerField(default=2020)),
                ('matchday', models.IntegerField(default=1)),
                ('played', models.BooleanField(default=False)),
                ('away', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='away_fixtures', to='main.club')),
                ('home', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='home_fixtures', to='main.club')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='fixtures', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['season', 'matchday', 'home'],
            },
        ),
        migrations.CreateModel(
            name='Nation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nationality', models.CharField(help_text='Enter name of country.', max_length=20, unique=True)),
                ('flag', models.FileField(blank=True, help_text='Upload svg image of nation flag.', null=True, upload_to='flags')),
                ('nat_code', models.CharField(help_text="Enter valid <a href='https://faker.readthedocs.io/en/master/locales.html'>faker locale code</a>.", max_length=5)),
            ],
        ),
        migrations.CreateModel(
            name='PlayerAttr',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('age', models.IntegerField()),
                ('speed', models.DecimalField(decimal_places=2, max_digits=4)),
                ('strength', models.DecimalField(decimal_places=2, max_digits=4)),
                ('technique', models.DecimalField(decimal_places=2, max_digits=4)),
                ('potential', models.DecimalField(decimal_places=2, max_digits=4)),
                ('handsomeness', models.DecimalField(decimal_places=2, max_digits=4)),
                ('value', models.DecimalField(decimal_places=2, max_digits=4)),
                ('ovr', models.DecimalField(blank=True, decimal_places=1, max_digits=3, null=True)),
                ('squad_num', models.IntegerField()),
            ],
            options={
                'ordering': ['squad_num', '-value'],
            },
        ),
        migrations.CreateModel(
            name='PlayerInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Enter a player name.', max_length=100)),
                ('pos', models.CharField(help_text='Enter player position', max_length=3)),
                ('nation', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='main.nation')),
                ('starter_club', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='starter_players', to='main.clubinfo')),
            ],
        ),
        migrations.CreateModel(
            name='Player',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('club', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='club_players', to='main.club')),
                ('player_attr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='player_instance', to='main.playerattr')),
                ('player_info', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='player', to='main.playerinfo')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='players', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='News',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('message_id', models.IntegerField()),
                ('sender', models.CharField(max_length=100)),
                ('subject', models.CharField(max_length=500)),
                ('body', models.TextField(default='I am a wealthy Nigerian Prince and I need some help in moving my fortune to your\n         country. I will reward you handsomely with many jewels and diamonds and monies. Please\n         reply immediately with your bank details and personal information as so to proceed.')),
                ('offer', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=5, null=True)),
                ('read', models.BooleanField(default=False)),
                ('club', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='club_news', to='main.club')),
                ('player', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='player_news', to='main.player')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='news', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ManagerInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('age', models.IntegerField(default=40)),
                ('board_confidence', models.IntegerField(default=40)),
                ('user_manager', models.BooleanField(default=False)),
                ('nation', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='main.nation')),
                ('starter_club', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='starter_manager', to='main.clubinfo')),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Manager',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('club', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='manager', to='main.club')),
                ('manager_info', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='main.managerinfo')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='managers', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Goal',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('minute', models.IntegerField()),
                ('fixture', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fixture_goals', to='main.fixture')),
                ('scorer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='goals', to='main.player')),
            ],
        ),
        migrations.AddConstraint(
            model_name='clubattr',
            constraint=models.CheckConstraint(check=models.Q(('ovr__gte', 0), ('ovr__lte', 20)), name='A value between 1 and 20 is required.'),
        ),
        migrations.AddField(
            model_name='club',
            name='club_attr',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='club_instance', to='main.clubattr'),
        ),
        migrations.AddField(
            model_name='club',
            name='club_info',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='club', to='main.clubinfo'),
        ),
        migrations.AddField(
            model_name='club',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='clubs', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='user',
            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='user',
            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'),
        ),
    ]
