# Generated by Django 4.2.6 on 2023-11-10 19:54

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


class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Room",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.TextField()),
                ("capacity", models.PositiveSmallIntegerField(default=0)),
                ("description", models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="ScheduleTime",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.TextField()),
                ("start", models.DateTimeField()),
                ("end", models.DateTimeField()),
                ("allow_sessions", models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name="UnConferenceEvent",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.TextField()),
                ("start", models.DateTimeField()),
                ("end", models.DateTimeField()),
                ("active", models.BooleanField(default=False)),
            ],
            options={
                "verbose_name": "UnConference event",
            },
        ),
        migrations.CreateModel(
            name="Session",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("leaders", models.TextField(blank=True, null=True)),
                ("title", models.TextField()),
                ("description", models.TextField(blank=True, null=True)),
                (
                    "session_type",
                    models.PositiveSmallIntegerField(
                        choices=[(1, "Talk"), (2, "Discussion"), (3, "Hands-On")],
                        default=1,
                        help_text="The type of session.",
                    ),
                ),
                (
                    "room",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="unconference.room",
                    ),
                ),
                (
                    "schedule_time",
                    models.ForeignKey(
                        limit_choices_to={"allow_sessions": True},
                        on_delete=django.db.models.deletion.PROTECT,
                        to="unconference.scheduletime",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="scheduletime",
            name="unconference_event",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to="unconference.unconferenceevent",
            ),
        ),
        migrations.AddField(
            model_name="room",
            name="unconference_event",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to="unconference.unconferenceevent",
            ),
        ),
        migrations.AddConstraint(
            model_name="session",
            constraint=models.UniqueConstraint(
                fields=("schedule_time", "room"), name="unique_booking"
            ),
        ),
        migrations.AddConstraint(
            model_name="scheduletime",
            constraint=models.UniqueConstraint(
                fields=("unconference_event", "title"), name="unique_schedule_time"
            ),
        ),
        migrations.AddConstraint(
            model_name="room",
            constraint=models.UniqueConstraint(
                fields=("unconference_event", "title"), name="unique_room"
            ),
        ),
    ]
