# Generated by Django 3.0.3 on 2020-03-10 15:12

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('competition_calendar', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('teams', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='TeamCompetitionEvent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, editable=False, help_text='Create time')),
                ('last_update_time', models.DateTimeField(default=django.utils.timezone.now, editable=False, help_text='Time of the last change.')),
                ('name', models.CharField(help_text='Name of the event', max_length=255, verbose_name='Name')),
                ('description', models.TextField(blank=True, help_text='Description of the run', null=True, verbose_name='description')),
                ('slug', models.SlugField(blank=True, unique=True, verbose_name='slug')),
                ('competition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='competition_calendar.Competition')),
                ('create_by', models.ForeignKey(blank=True, editable=False, help_text='User how create this entry.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='teamcompetitionevent_create_by', to=settings.AUTH_USER_MODEL)),
                ('last_update_by', models.ForeignKey(blank=True, editable=False, help_text='User as last edit this entry.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='teamcompetitionevent_last_update_by', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='TeamWorkoutEvent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, editable=False, help_text='Create time')),
                ('last_update_time', models.DateTimeField(default=django.utils.timezone.now, editable=False, help_text='Time of the last change.')),
                ('name', models.CharField(help_text='Name of the event', max_length=255, verbose_name='Name')),
                ('description', models.TextField(blank=True, help_text='Description of the run', null=True, verbose_name='description')),
                ('slug', models.SlugField(blank=True, unique=True, verbose_name='slug')),
                ('distance_km', models.DecimalField(decimal_places=4, help_text='The ideal track length in kilometer.', max_digits=7, unique=True, verbose_name='distance')),
                ('ascent', models.SmallIntegerField(blank=True, null=True, verbose_name='Ascent')),
                ('descent', models.SmallIntegerField(blank=True, null=True, verbose_name='Descent')),
                ('peace', models.SmallIntegerField(blank=True, help_text='average pace at which you plan to run.', null=True, verbose_name='planned peace')),
                ('start_date', models.DateField(help_text='Start date of the Workout', verbose_name='start date')),
                ('start_time', models.TimeField(verbose_name='start time')),
                ('gpx', models.FileField(upload_to='uploads/%Y/%m/%d/')),
                ('private', models.BooleanField(default=False, verbose_name='private')),
                ('create_by', models.ForeignKey(blank=True, editable=False, help_text='User how create this entry.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='teamworkoutevent_create_by', to=settings.AUTH_USER_MODEL)),
                ('last_update_by', models.ForeignKey(blank=True, editable=False, help_text='User as last edit this entry.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='teamworkoutevent_last_update_by', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserWorkoutEvent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, editable=False, help_text='Create time')),
                ('last_update_time', models.DateTimeField(default=django.utils.timezone.now, editable=False, help_text='Time of the last change.')),
                ('name', models.CharField(help_text='Name of the event', max_length=255, verbose_name='Name')),
                ('description', models.TextField(blank=True, help_text='Description of the run', null=True, verbose_name='description')),
                ('slug', models.SlugField(blank=True, unique=True, verbose_name='slug')),
                ('distance_km', models.DecimalField(decimal_places=4, help_text='The ideal track length in kilometer.', max_digits=7, unique=True, verbose_name='distance')),
                ('ascent', models.SmallIntegerField(blank=True, null=True, verbose_name='Ascent')),
                ('descent', models.SmallIntegerField(blank=True, null=True, verbose_name='Descent')),
                ('peace', models.SmallIntegerField(blank=True, help_text='average pace at which you plan to run.', null=True, verbose_name='planned peace')),
                ('start_date', models.DateField(help_text='Start date of the Workout', verbose_name='start date')),
                ('start_time', models.TimeField(verbose_name='start time')),
                ('gpx', models.FileField(upload_to='uploads/%Y/%m/%d/')),
                ('private', models.BooleanField(default=False, verbose_name='private')),
                ('create_by', models.ForeignKey(blank=True, editable=False, help_text='User how create this entry.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='userworkoutevent_create_by', to=settings.AUTH_USER_MODEL)),
                ('last_update_by', models.ForeignKey(blank=True, editable=False, help_text='User as last edit this entry.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='userworkoutevent_last_update_by', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserWorkoutParticipants',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('user_workout', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.UserWorkoutEvent')),
            ],
        ),
        migrations.AddField(
            model_name='userworkoutevent',
            name='participants',
            field=models.ManyToManyField(through='events.UserWorkoutParticipants', to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='TeamWorkoutParticipants',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('team_workout', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.TeamWorkoutEvent')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='teamworkoutevent',
            name='participants',
            field=models.ManyToManyField(through='events.TeamWorkoutParticipants', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='teamworkoutevent',
            name='team',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='teams.Team'),
        ),
        migrations.CreateModel(
            name='TeamCompetitionParticipants',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('distance', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='competition_calendar.Distance')),
                ('team_event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.TeamCompetitionEvent')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'unique_together': {('user', 'distance')},
            },
        ),
        migrations.AddField(
            model_name='teamcompetitionevent',
            name='participants',
            field=models.ManyToManyField(through='events.TeamCompetitionParticipants', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='teamcompetitionevent',
            name='team',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='teams.Team'),
        ),
    ]
