# Generated by Django 3.2.13 on 2022-09-28 12:51

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("wagtailcore", "0069_log_entry_jsonfield"),
    ]

    operations = [
        migrations.CreateModel(
            name="Course",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.CharField(max_length=255, verbose_name="Titel")),
                (
                    "category_name",
                    models.CharField(
                        default="Kategorie",
                        max_length=255,
                        verbose_name="Kategorie-Name",
                    ),
                ),
            ],
            options={
                "verbose_name": "Lehrgang",
            },
        ),
        migrations.CreateModel(
            name="CoursePage",
            fields=[
                (
                    "page_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="wagtailcore.page",
                    ),
                ),
                (
                    "course",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT, to="course.course"
                    ),
                ),
            ],
            options={
                "verbose_name": "Lehrgang-Seite",
            },
            bases=("wagtailcore.page",),
        ),
        migrations.CreateModel(
            name="CourseCompletion",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        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)),
                ("page_key", models.UUIDField()),
                ("page_type", models.CharField(blank=True, default="", max_length=255)),
                ("page_slug", models.CharField(blank=True, default="", max_length=255)),
                (
                    "completion_status",
                    models.CharField(
                        choices=[
                            ("unknown", "unknown"),
                            ("success", "success"),
                            ("fail", "fail"),
                        ],
                        default="unknown",
                        max_length=255,
                    ),
                ),
                ("additional_json_data", models.JSONField(default=dict)),
                (
                    "course",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="course.course"
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="CourseCategory",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "title",
                    models.CharField(blank=True, max_length=255, verbose_name="Titel"),
                ),
                (
                    "general",
                    models.BooleanField(default=False, verbose_name="Allgemein"),
                ),
                (
                    "course",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="course.course"
                    ),
                ),
            ],
        ),
        migrations.AddConstraint(
            model_name="coursecompletion",
            constraint=models.UniqueConstraint(
                fields=("user", "page_key"),
                name="course_completion_unique_user_page_key",
            ),
        ),
    ]
