# Generated by Django 3.2.13 on 2023-05-12 15:29

import django.db.models.deletion
import wagtail.blocks
import wagtail.fields
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("wagtailcore", "0083_workflowcontenttype"),
    ]

    operations = [
        migrations.CreateModel(
            name="Assignment",
            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",
                    ),
                ),
                (
                    "intro_text",
                    wagtail.fields.RichTextField(
                        help_text="Erläuterung der Ausgangslage"
                    ),
                ),
                (
                    "effort_required",
                    models.CharField(
                        blank=True, help_text="Zeitaufwand als Text", max_length=100
                    ),
                ),
                (
                    "performance_objectives",
                    wagtail.fields.StreamField(
                        [
                            (
                                "performance_objective",
                                wagtail.blocks.StructBlock(
                                    [("text", wagtail.blocks.TextBlock())]
                                ),
                            )
                        ],
                        blank=True,
                        help_text="Leistungsziele des Auftrags",
                        use_json_field=True,
                    ),
                ),
                (
                    "tasks",
                    wagtail.fields.StreamField(
                        [
                            (
                                "task",
                                wagtail.blocks.StructBlock(
                                    [
                                        ("title", wagtail.blocks.TextBlock()),
                                        (
                                            "file_submission_required",
                                            wagtail.blocks.BooleanBlock(required=False),
                                        ),
                                        (
                                            "content",
                                            wagtail.blocks.StreamBlock(
                                                [
                                                    (
                                                        "explanation",
                                                        wagtail.blocks.StructBlock(
                                                            [
                                                                (
                                                                    "text",
                                                                    wagtail.blocks.RichTextBlock(
                                                                        features=[
                                                                            "ul",
                                                                            "bold",
                                                                            "italic",
                                                                        ]
                                                                    ),
                                                                )
                                                            ]
                                                        ),
                                                    ),
                                                    (
                                                        "user_text_input",
                                                        wagtail.blocks.StructBlock(
                                                            [
                                                                (
                                                                    "text",
                                                                    wagtail.blocks.RichTextBlock(
                                                                        blank=True,
                                                                        features=[
                                                                            "ul",
                                                                            "bold",
                                                                            "italic",
                                                                        ],
                                                                        required=False,
                                                                    ),
                                                                )
                                                            ]
                                                        ),
                                                    ),
                                                    (
                                                        "user_confirmation",
                                                        wagtail.blocks.StructBlock(
                                                            [
                                                                (
                                                                    "text",
                                                                    wagtail.blocks.RichTextBlock(
                                                                        features=[
                                                                            "ul",
                                                                            "bold",
                                                                            "italic",
                                                                        ]
                                                                    ),
                                                                )
                                                            ]
                                                        ),
                                                    ),
                                                ],
                                                blank=True,
                                            ),
                                        ),
                                    ]
                                ),
                            )
                        ],
                        blank=True,
                        help_text="Teilaufgaben",
                        use_json_field=True,
                    ),
                ),
                (
                    "evaluation_description",
                    wagtail.fields.RichTextField(
                        blank=True, help_text="Beschreibung der Bewertung"
                    ),
                ),
                (
                    "evaluation_document_url",
                    models.CharField(
                        blank=True,
                        help_text="URL zum Beurteilungsinstrument",
                        max_length=255,
                    ),
                ),
                (
                    "evaluation_tasks",
                    wagtail.fields.StreamField(
                        [
                            (
                                "task",
                                wagtail.blocks.StructBlock(
                                    [
                                        ("title", wagtail.blocks.TextBlock()),
                                        (
                                            "description",
                                            wagtail.blocks.RichTextBlock(
                                                blank=True,
                                                features=["ul", "bold", "italic"],
                                                required=False,
                                            ),
                                        ),
                                        ("max_points", wagtail.blocks.IntegerBlock()),
                                        (
                                            "sub_tasks",
                                            wagtail.blocks.ListBlock(
                                                wagtail.blocks.StructBlock(
                                                    [
                                                        (
                                                            "title",
                                                            wagtail.blocks.TextBlock(),
                                                        ),
                                                        (
                                                            "description",
                                                            wagtail.blocks.RichTextBlock(
                                                                blank=True,
                                                                features=[
                                                                    "ul",
                                                                    "bold",
                                                                    "italic",
                                                                ],
                                                                required=False,
                                                            ),
                                                        ),
                                                        (
                                                            "points",
                                                            wagtail.blocks.IntegerBlock(),
                                                        ),
                                                    ]
                                                ),
                                                blank=True,
                                                use_json_field=True,
                                            ),
                                        ),
                                    ]
                                ),
                            )
                        ],
                        blank=True,
                        help_text="Beurteilungsschritte",
                        use_json_field=True,
                    ),
                ),
            ],
            options={
                "verbose_name": "Auftrag",
            },
            bases=("wagtailcore.page",),
        ),
        migrations.CreateModel(
            name="AssignmentCompletion",
            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)),
                ("submitted_at", models.DateTimeField(blank=True, null=True)),
                (
                    "evaluation_submitted_at",
                    models.DateTimeField(blank=True, null=True),
                ),
                ("evaluation_grade", models.FloatField(blank=True, null=True)),
                ("evaluation_points", models.FloatField(blank=True, null=True)),
                (
                    "completion_status",
                    models.CharField(
                        choices=[
                            ("IN_PROGRESS", "IN_PROGRESS"),
                            ("SUBMITTED", "SUBMITTED"),
                            ("EVALUATION_IN_PROGRESS", "EVALUATION_IN_PROGRESS"),
                            ("EVALUATION_SUBMITTED", "EVALUATION_SUBMITTED"),
                        ],
                        default="IN_PROGRESS",
                        max_length=255,
                    ),
                ),
                ("completion_data", models.JSONField(default=dict)),
                ("additional_json_data", models.JSONField(default=dict)),
            ],
        ),
        migrations.CreateModel(
            name="AssignmentListPage",
            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",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
            bases=("wagtailcore.page",),
        ),
        migrations.CreateModel(
            name="AssignmentCompletionAuditLog",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "completion_status",
                    models.CharField(
                        choices=[
                            (1, "IN_PROGRESS"),
                            (2, "SUBMITTED"),
                            (3, "EVALUATION_IN_PROGRESS"),
                            (4, "EVALUATION_SUBMITTED"),
                        ],
                        default="IN_PROGRESS",
                        max_length=255,
                    ),
                ),
                ("completion_data", models.JSONField(default=dict)),
                ("additional_json_data", models.JSONField(default=dict)),
                ("assignment_user_email", models.CharField(max_length=255)),
                ("assignment_slug", models.CharField(max_length=255)),
                (
                    "evaluation_user_email",
                    models.CharField(blank=True, default="", max_length=255),
                ),
                ("evaluation_grade", models.FloatField(blank=True, null=True)),
                ("evaluation_points", models.FloatField(blank=True, null=True)),
                (
                    "assignment",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to="assignment.assignment",
                    ),
                ),
            ],
        ),
    ]
