# Generated by Django 3.2.3 on 2021-05-17 20:40

import courses.defines
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import enumchoicefield.fields
import re
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Course',
            fields=[
                ('course_id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('course_code', models.CharField(db_index=True, max_length=9, validators=[django.core.validators.RegexValidator(message='Course code format must be xxxx-xxxx', regex=re.compile('^\\d{4}-\\d{4}$'))])),
            ],
        ),
        migrations.CreateModel(
            name='CourseInstance',
            fields=[
                ('course_instance_id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('year', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(2000), django.core.validators.MaxValueValidator(2040)])),
                ('semester', enumchoicefield.fields.EnumChoiceField(enum_class=courses.defines.Semester, max_length=8)),
                ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='instances', to='courses.course')),
            ],
            options={
                'ordering': ('course', '-year', '-semester'),
                'unique_together': {('course', 'year', 'semester')},
            },
        ),
        migrations.CreateModel(
            name='CourseGroup',
            fields=[
                ('course_group_id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('course_group_name', models.CharField(max_length=4)),
                ('course_instance', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='groups', to='courses.courseinstance')),
            ],
            options={
                'ordering': ('course_instance', 'course_group_name'),
                'unique_together': {('course_instance', 'course_group_name')},
            },
        ),
        migrations.CreateModel(
            name='CourseInstanceName',
            fields=[
                ('course_name_id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('language', enumchoicefield.fields.EnumChoiceField(enum_class=courses.defines.Language, max_length=2)),
                ('course_name', models.CharField(db_index=True, max_length=255)),
                ('course_instance', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='names', to='courses.courseinstance')),
            ],
            options={
                'ordering': ('course_instance', '-language'),
                'unique_together': {('course_instance', 'language')},
            },
        ),
        migrations.CreateModel(
            name='CourseGroupTeacher',
            fields=[
                ('teacher_id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('teacher_name', models.CharField(max_length=255)),
                ('course_group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='teachers', to='courses.coursegroup')),
            ],
            options={
                'ordering': ('course_group', 'teacher_name'),
                'unique_together': {('course_group', 'teacher_name')},
            },
        ),
        migrations.CreateModel(
            name='CourseCommonName',
            fields=[
                ('course_name_id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('language', enumchoicefield.fields.EnumChoiceField(enum_class=courses.defines.Language, max_length=2)),
                ('course_name', models.CharField(db_index=True, max_length=255)),
                ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='most_common_names', to='courses.course')),
            ],
            options={
                'ordering': ('course', '-language'),
                'unique_together': {('course', 'language')},
            },
        ),
    ]
