# Generated by Django 2.0.3 on 2018-04-26 11:07

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),
    ]

    operations = [
        migrations.CreateModel(
            name='Gym',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('name', models.CharField(max_length=255)),
                ('description', models.CharField(max_length=255)),
                ('slug', models.CharField(max_length=255, unique=True)),
            ],
            options={
                'db_table': 'gym',
            },
        ),
        migrations.CreateModel(
            name='GymProblem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('order', models.IntegerField()),
                ('is_active', models.BooleanField(default=True)),
                ('gym', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Gym')),
            ],
            options={
                'db_table': 'gym_problem',
            },
        ),
        migrations.CreateModel(
            name='JudgeResult',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('status', models.CharField(choices=[('ENQ', 'enqueued'), ('IP', 'in_progress'), ('CTE', 'compile_error'), ('PASS', 'passed'), ('FAIL', 'failed'), ('ERR', 'internal_error')], max_length=255)),
                ('memory_used_bytes', models.IntegerField()),
                ('time_elapsed_seconds', models.IntegerField()),
                ('code_size', models.IntegerField()),
                ('score', models.IntegerField()),
                ('detail', models.URLField()),
            ],
            options={
                'db_table': 'judge_result',
            },
        ),
        migrations.CreateModel(
            name='JudgeSpec',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('type', models.CharField(choices=[('Batch', 'batch'), ('Batch with grader', 'batch_with_grader'), ('Output only', 'output_only')], max_length=255)),
                ('config', models.URLField()),
                ('grader', models.URLField()),
                ('test_data', models.URLField()),
            ],
            options={
                'db_table': 'judge_spec',
            },
        ),
        migrations.CreateModel(
            name='Problem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('type', models.CharField(choices=[('Batch', 'batch'), ('Reactive', 'reactive'), ('Output only', 'output_only')], max_length=255)),
                ('description', models.URLField()),
                ('slug', models.CharField(max_length=255, unique=True)),
                ('judge_spec', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='api.JudgeSpec')),
            ],
            options={
                'db_table': 'problem',
            },
        ),
        migrations.CreateModel(
            name='ProblemTag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Problem')),
            ],
            options={
                'db_table': 'problem_tag',
            },
        ),
        migrations.CreateModel(
            name='Submission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('lang_profile', models.CharField(choices=[('c++', 'cpp'), ('java', 'java'), ('python3', 'python3'), ('go', 'go')], max_length=20)),
                ('submission_data', models.URLField()),
                ('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Problem')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'submission',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField()),
            ],
            options={
                'db_table': 'tag',
            },
        ),
        migrations.AddField(
            model_name='problemtag',
            name='tag',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Tag'),
        ),
        migrations.AddField(
            model_name='problem',
            name='tags',
            field=models.ManyToManyField(through='api.ProblemTag', to='api.Tag'),
        ),
        migrations.AddField(
            model_name='judgeresult',
            name='submission',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='api.Submission'),
        ),
        migrations.AddField(
            model_name='gymproblem',
            name='problem',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Problem'),
        ),
        migrations.AddField(
            model_name='gym',
            name='problems',
            field=models.ManyToManyField(through='api.GymProblem', to='api.Problem'),
        ),
    ]
