# Generated by Django 3.1.6 on 2021-02-22 07:47

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("user", "0002_auto_20210216_0650"),
    ]

    operations = [
        migrations.CreateModel(
            name="Person",
            fields=[
                (
                    "user",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        primary_key=True,
                        related_name="profile",
                        serialize=False,
                        to="user.user",
                    ),
                ),
                ("do_not_work_for_dit", models.BooleanField(default=False)),
                (
                    "manager",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to="peoplefinder.person",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Team",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=255, unique=True)),
                (
                    "abbreviation",
                    models.CharField(blank=True, max_length=10, null=True),
                ),
                ("slug", models.SlugField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name="TeamMember",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("job_title", models.CharField(max_length=100)),
                ("head_of_team", models.BooleanField(default=False)),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="peoplefinder.person",
                    ),
                ),
                (
                    "team",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="peoplefinder.team",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="team",
            name="people",
            field=models.ManyToManyField(
                related_name="teams",
                through="peoplefinder.TeamMember",
                to="peoplefinder.Person",
            ),
        ),
        migrations.CreateModel(
            name="TeamTree",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("depth", models.SmallIntegerField()),
                (
                    "child",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="children",
                        to="peoplefinder.team",
                    ),
                ),
                (
                    "parent",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="parents",
                        to="peoplefinder.team",
                    ),
                ),
            ],
            options={
                "unique_together": {("parent", "child")},
            },
        ),
    ]
