# Generated by Django 2.1.5 on 2019-09-26 17:51

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import phonenumber_field.modelfields


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("webapp", "0055_auto_20190926_2048"),
    ]

    operations = [
        migrations.CreateModel(
            name="Occupation",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("start_date", models.DateField(verbose_name="Start date")),
                ("end_date", models.DateField(verbose_name="End date")),
            ],
            options={
                "verbose_name": "Occupation",
                "verbose_name_plural": "Occupations",
            },
        ),
        migrations.CreateModel(
            name="Official",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "first_name",
                    models.CharField(max_length=30, verbose_name="First name"),
                ),
                (
                    "last_name",
                    models.CharField(max_length=150, verbose_name="Last name"),
                ),
                (
                    "email",
                    models.EmailField(max_length=254, verbose_name="Email address"),
                ),
                (
                    "phone_number",
                    phonenumber_field.modelfields.PhoneNumberField(
                        max_length=128, verbose_name="Phone number"
                    ),
                ),
                (
                    "role_history",
                    models.ManyToManyField(blank=True, to="webapp.Occupation"),
                ),
                (
                    "user",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Official",
                "verbose_name_plural": "Officials",
            },
        ),
        migrations.RemoveField(
            model_name="role",
            name="end_date",
        ),
        migrations.RemoveField(
            model_name="role",
            name="start_date",
        ),
        migrations.AddField(
            model_name="occupation",
            name="role",
            field=models.OneToOneField(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="webapp.Role",
            ),
        ),
    ]
