# Generated by Django 3.1.4 on 2021-01-21 06:25

from django.conf import settings
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),
        ('problem', '0004_auto_20210106_1200'),
    ]

    operations = [
        migrations.CreateModel(
            name='Contest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, default=' ', max_length=100)),
                ('duration', models.DurationField(default=120)),
                ('startTime', models.DateTimeField(auto_now_add=True)),
                ('numberOfProblem', models.IntegerField(default=5)),
                ('platform', models.CharField(blank=True, default='F', max_length=5)),
                ('tag', models.CharField(blank=True, default='', max_length=500)),
                ('rating', models.IntegerField(default=1200)),
                ('difficulty', models.CharField(choices=[('B', 'Beginner'), ('E', 'Easy'), ('M', 'Medium'), ('H', 'Hard'), ('S', 'Super-Hard'), ('C', 'Challenging'), ('R', 'Random')], default='R', max_length=1)),
                ('isMentorOn', models.BooleanField(default=False)),
                ('isTeam', models.BooleanField(default=False)),
                ('isProblem', models.BooleanField(default=False)),
                ('isResult', models.BooleanField(default=False)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contest_owner', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ContestParticipation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('contest', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contest.contest')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ContestProblem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('index', models.IntegerField()),
                ('contest', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contest.contest')),
                ('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='problem.problem')),
            ],
        ),
        migrations.CreateModel(
            name='ContestResult',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('submissionTime', models.DateTimeField(auto_now_add=True)),
                ('verdict', models.BooleanField(default=True)),
                ('contestParticipation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contest.contestparticipation')),
                ('contestProblem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contest.contestproblem')),
            ],
        ),
        migrations.AddField(
            model_name='contest',
            name='participants',
            field=models.ManyToManyField(related_name='contest_participants', through='contest.ContestParticipation', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='contest',
            name='problem',
            field=models.ManyToManyField(related_name='contest_problem', through='contest.ContestProblem', to='problem.Problem'),
        ),
    ]
