# Generated by Django 4.1 on 2022-12-16 14:16

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


class Migration(migrations.Migration):
    dependencies = [
        ("agenda", "0004_alter_calendaritem_item_type"),
    ]

    operations = [
        migrations.CreateModel(
            name="Building",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=255, verbose_name="Name")),
                (
                    "address",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="conference_room_building",
                        to="directory.addresscontact",
                        verbose_name="Address",
                    ),
                ),
            ],
            options={
                "verbose_name": "Building",
            },
        ),
        migrations.AddConstraint(
            model_name="building",
            constraint=models.UniqueConstraint(
                fields=("name", "address"),
                name="unique_building",
            ),
        ),
        migrations.CreateModel(
            name="ConferenceRoom",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=255, verbose_name="Name")),
                ("email", models.EmailField(verbose_name="Email Address", unique=True)),
                ("capacity", models.PositiveIntegerField(blank=True, null=True, verbose_name="Capacity")),
                (
                    "is_videoconference_capable",
                    models.BooleanField(default=True, verbose_name="Capable of Videoconferencing"),
                ),
                (
                    "building",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="conference_room",
                        to="agenda.building",
                        verbose_name="Building",
                    ),
                ),
            ],
            options={
                "verbose_name": "Conference Room",
            },
        ),
        migrations.AddConstraint(
            model_name="conferenceroom",
            constraint=models.UniqueConstraint(
                fields=("name", "building"),
                name="unique_conference_room",
            ),
        ),
        migrations.AddField(
            model_name="calendaritem",
            name="conference_room_new",
            field=models.ForeignKey(
                related_name="calendar_item",
                to="agenda.conferenceroom",
                verbose_name="Conference Room",
                on_delete=models.SET_NULL,
                null=True,
                blank=True,
            ),
        ),
        migrations.RemoveField(
            model_name="calendaritem",
            name="conference_room",
        ),
        migrations.RenameField(
            model_name="calendaritem",
            old_name="conference_room_new",
            new_name="conference_room",
        ),
    ]
