# Generated by Django 3.2.19 on 2023-05-16 14:28

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

from NEMO.apps.nemo_ce.migration_utils import NEMOMigration


class Migration(NEMOMigration):

    dependencies = [
        ("NEMO", "0045_version_4_5_0"),
        ("nemo_ce", "0003_ce_training_module"),
    ]

    operations = [
        migrations.CreateModel(
            name="QualificationLevel",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=255, unique=True)),
                (
                    "qualify_user",
                    models.BooleanField(
                        default=False,
                        help_text="Indicates that this qualification level will qualify the user to use the tool.",
                    ),
                ),
                (
                    "qualify_schedule",
                    models.BooleanField(
                        default=False,
                        help_text="Indicates that the qualification only applies to a certain time range.",
                    ),
                ),
                (
                    "schedule_start_time",
                    models.TimeField(blank=True, help_text="The qualification start time", null=True),
                ),
                ("schedule_end_time", models.TimeField(blank=True, help_text="The qualification end time", null=True)),
                (
                    "qualify_weekends",
                    models.BooleanField(
                        default=False,
                        help_text="Check this box if the times should apply to weekend days. Default is False, meaning the user won't be qualified on weekends regardless of times.",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AddField(
            model_name="qualification",
            name="qualification_level",
            field=models.ForeignKey(
                blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to="NEMO.qualificationlevel"
            ),
        ),
        migrations.AlterModelOptions(
            name="qualification",
            options={"get_latest_by": "qualified_on", "ordering": ["-qualified_on"]},
        ),
        migrations.AddField(
            model_name="membershiphistory",
            name="details",
            field=models.CharField(blank=True, help_text="Additional details", max_length=200, null=True),
        ),
    ]
