# Generated by Django 2.2 on 2019-07-22 16:47

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


class Migration(migrations.Migration):

    replaces = [
        ("frontend", "0001_initial"),
        ("frontend", "0002_measure"),
        ("frontend", "0003_auto_20190722_1630"),
    ]

    dependencies = [("contenttypes", "0002_remove_content_type_name")]

    operations = [
        migrations.CreateModel(
            name="Group",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=200)),
                ("open_date", models.DateField(blank=True, null=True)),
                ("close_date", models.DateField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="GroupKind",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=200)),
            ],
        ),
        migrations.CreateModel(
            name="Practice",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=200)),
                ("address1", models.CharField(blank=True, max_length=200, null=True)),
                ("address2", models.CharField(blank=True, max_length=200, null=True)),
                ("address3", models.CharField(blank=True, max_length=200, null=True)),
                ("address4", models.CharField(blank=True, max_length=200, null=True)),
                ("address5", models.CharField(blank=True, max_length=200, null=True)),
                ("postcode", models.CharField(blank=True, max_length=9, null=True)),
                (
                    "setting",
                    models.IntegerField(
                        choices=[
                            (-1, "Unknown"),
                            (0, "Other"),
                            (1, "WIC Practice"),
                            (2, "OOH Practice"),
                            (3, "WIC + OOH Practice"),
                            (4, "GP Practice"),
                            (8, "Public Health Service"),
                            (9, "Community Health Service"),
                            (10, "Hospital Service"),
                            (11, "Optometry Service"),
                            (12, "Urgent & Emergency Care"),
                            (13, "Hospice"),
                            (14, "Care Home / Nursing Home"),
                            (15, "Border Force"),
                            (16, "Young Offender Institution"),
                            (17, "Secure Training Centre"),
                            (18, "Secure Children's Home"),
                            (19, "Immigration Removal Centre"),
                            (20, "Court"),
                            (21, "Police Custody"),
                            (22, "Sexual Assault Referral Centre (SARC)"),
                            (24, "Other - Justice Estate"),
                            (25, "Prison"),
                        ],
                        default=-1,
                    ),
                ),
                ("open_date", models.DateField(blank=True, null=True)),
                ("close_date", models.DateField(blank=True, null=True)),
                (
                    "status_code",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("U", "Unknown"),
                            ("A", "Active"),
                            ("B", "Retired"),
                            ("C", "Closed"),
                            ("D", "Dormant"),
                            ("P", "Proposed"),
                        ],
                        max_length=1,
                        null=True,
                    ),
                ),
                ("groups", models.ManyToManyField(to="frontend.Group")),
            ],
        ),
        migrations.AddField(
            model_name="group",
            name="kind",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT, to="frontend.GroupKind"
            ),
        ),
        migrations.CreateModel(
            name="Coding",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("system", models.CharField(db_index=True, max_length=200)),
                ("code", models.CharField(db_index=True, max_length=50)),
                ("object_id", models.PositiveIntegerField()),
                (
                    "content_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.ContentType",
                    ),
                ),
            ],
        ),
        migrations.AddConstraint(
            model_name="coding",
            constraint=models.UniqueConstraint(
                fields=("system", "code"), name="system_and_code_unique_together"
            ),
        ),
        migrations.CreateModel(
            name="Measure",
            fields=[
                (
                    "id",
                    models.CharField(max_length=40, primary_key=True, serialize=False),
                ),
                ("title", models.CharField(max_length=500)),
                ("why_it_matters", models.TextField(blank=True, null=True)),
            ],
        ),
    ]
