# Generated by Django 3.2.4 on 2021-11-20 14:47

import Main.models.mixins
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 = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Set',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.TextField()),
                ('public', models.BooleanField(default=False)),
                ('opened', models.BooleanField(default=False)),
                ('start_time', models.DateTimeField(default=django.utils.timezone.now)),
                ('end_time', models.DateTimeField(default=django.utils.timezone.now)),
                ('creator', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Solution',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('language_id', models.IntegerField(default=0)),
                ('time_sent', models.DateTimeField(default=django.utils.timezone.now)),
                ('result', models.TextField(default='In queue')),
            ],
        ),
        migrations.CreateModel(
            name='UserInfo',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('surname', models.TextField(null=True)),
                ('name', models.TextField(null=True)),
                ('last_request', models.DateTimeField(default=django.utils.timezone.now)),
                ('profile_picture_fs_id', models.IntegerField(null=True)),
                ('favourite_language_id', models.IntegerField(null=True)),
                ('rating', models.IntegerField(default=0)),
                ('telegram_chat_id', models.TextField(default='')),
                ('notification_solution_result', models.BooleanField(default=False)),
                ('verified', models.BooleanField(default=False)),
                ('user', models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Task',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.TextField()),
                ('public', models.BooleanField(default=False)),
                ('legend', models.TextField(default='')),
                ('input_format', models.TextField(default='')),
                ('output_format', models.TextField(default='')),
                ('specifications', models.TextField(default='')),
                ('time_limit', models.IntegerField(default=10000)),
                ('time_estimation', models.IntegerField(default=5)),
                ('creator', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Subscription',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role', models.IntegerField()),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subscriptions', to='Main.group')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='SolutionFile',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('path', models.TextField()),
                ('fs_id', models.IntegerField()),
                ('solution', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Main.solution')),
            ],
            bases=(Main.models.mixins.FileStorageMixin, models.Model),
        ),
        migrations.AddField(
            model_name='solution',
            name='task',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Main.task'),
        ),
        migrations.AddField(
            model_name='solution',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='SetTask',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=2)),
                ('set', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Main.set')),
                ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='settasks', to='Main.task')),
            ],
        ),
        migrations.CreateModel(
            name='Progress',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_time', models.DateTimeField(default=django.utils.timezone.now)),
                ('finished_time', models.DateTimeField(null=True)),
                ('score', models.IntegerField(default=0)),
                ('finished', models.BooleanField(default=False)),
                ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Main.task')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='group',
            name='sets',
            field=models.ManyToManyField(to='Main.Set'),
        ),
        migrations.CreateModel(
            name='File',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.TextField()),
                ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Main.task')),
            ],
        ),
        migrations.CreateModel(
            name='ExtraFile',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('filename', models.TextField()),
                ('is_test', models.BooleanField(null=True)),
                ('is_sample', models.BooleanField(null=True)),
                ('readable', models.BooleanField(null=True)),
                ('test_number', models.IntegerField(null=True)),
                ('fs_id', models.IntegerField(null=True)),
                ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Main.task')),
            ],
            bases=(Main.models.mixins.FileStorageMixin, models.Model),
        ),
    ]
