# Generated by Django 3.2.4 on 2021-08-25 22:10

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import rest_api.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Course',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('course_id', models.IntegerField(validators=[rest_api.models._validate_non_negative_number])),
                ('data_year', models.IntegerField()),
                ('name', models.TextField()),
                ('semester', models.TextField(choices=[('FIRST', 'A'), ('SECOND', 'B'), ('SUMMER', 'Summer'), ('EITHER', 'Either'), ('ANNUAL', 'Annual')])),
                ('is_given_this_year', models.BooleanField()),
                ('points', models.FloatField()),
                ('is_corner_stone', models.BooleanField(null=True)),
                ('comment', models.TextField(blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='CourseGroup',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('data_year', models.IntegerField()),
                ('course_type', models.TextField(choices=[('MUST', 'Must'), ('CHOICE', 'Choice'), ('CHOOSE_FROM_LIST', 'From List'), ('CORNER_STONE', 'Corner Stone'), ('SUPPLEMENTARY', 'Supplementary')])),
                ('year_in_studies', models.IntegerField(choices=[(1, 'First'), (2, 'Second'), (3, 'Third'), (4, 'Fourth'), (5, 'Fifth'), (6, 'Sixth'), (7, 'Seventh')])),
                ('index_in_track_year', models.IntegerField(validators=[rest_api.models._validate_non_negative_number])),
                ('required_course_count', models.IntegerField(null=True, validators=[rest_api.models._validate_non_negative_number_or_null])),
                ('required_points', models.IntegerField(null=True, validators=[rest_api.models._validate_non_negative_number_or_null])),
                ('comment', models.TextField(null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Hug',
            fields=[
                ('id', models.IntegerField(primary_key=True, serialize=False)),
            ],
        ),
        migrations.CreateModel(
            name='Student',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('year_in_studies', models.IntegerField(choices=[(1, 'First'), (2, 'Second'), (3, 'Third'), (4, 'Fourth'), (5, 'Fifth'), (6, 'Sixth'), (7, 'Seventh')], null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Take',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('year_in_studies', models.IntegerField(choices=[(1, 'First'), (2, 'Second'), (3, 'Third'), (4, 'Fourth'), (5, 'Fifth'), (6, 'Sixth'), (7, 'Seventh')])),
                ('semester', models.TextField(choices=[('FIRST', 'A'), ('SECOND', 'B'), ('SUMMER', 'Summer'), ('EITHER', 'Either'), ('ANNUAL', 'Annual')])),
            ],
        ),
        migrations.CreateModel(
            name='Track',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('track_number', models.IntegerField(validators=[rest_api.models._validate_non_negative_number])),
                ('data_year', models.IntegerField()),
                ('name', models.TextField()),
                ('points_must', models.IntegerField(validators=[rest_api.models._validate_non_negative_number])),
                ('points_from_list', models.IntegerField(validators=[rest_api.models._validate_non_negative_number])),
                ('points_choice', models.IntegerField(validators=[rest_api.models._validate_non_negative_number])),
                ('points_complementary', models.IntegerField(validators=[rest_api.models._validate_non_negative_number])),
                ('points_corner_stones', models.IntegerField(validators=[rest_api.models._validate_non_negative_number])),
                ('points_minor', models.IntegerField(validators=[rest_api.models._validate_non_negative_number])),
                ('points_additional_hug', models.IntegerField(validators=[rest_api.models._validate_non_negative_number])),
                ('comment', models.TextField(blank=True)),
            ],
        ),
        migrations.AddConstraint(
            model_name='track',
            constraint=models.UniqueConstraint(fields=('track_number', 'data_year'), name='track_year'),
        ),
        migrations.AddField(
            model_name='take',
            name='course',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rest_api.course'),
        ),
        migrations.AddField(
            model_name='take',
            name='student',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rest_api.student'),
        ),
        migrations.AddField(
            model_name='student',
            name='courses',
            field=models.ManyToManyField(blank=True, through='rest_api.Take', to='rest_api.Course'),
        ),
        migrations.AddField(
            model_name='student',
            name='track',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='rest_api.track'),
        ),
        migrations.AddField(
            model_name='student',
            name='user',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='hug',
            name='courses',
            field=models.ManyToManyField(to='rest_api.Course'),
        ),
        migrations.AddField(
            model_name='coursegroup',
            name='courses',
            field=models.ManyToManyField(to='rest_api.Course'),
        ),
        migrations.AddField(
            model_name='coursegroup',
            name='track',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rest_api.track'),
        ),
        migrations.AlterUniqueTogether(
            name='course',
            unique_together={('course_id', 'data_year')},
        ),
        migrations.AddConstraint(
            model_name='coursegroup',
            constraint=models.UniqueConstraint(fields=('track', 'data_year', 'year_in_studies', 'course_type', 'index_in_track_year'), name='group_unique'),
        ),
    ]
