# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-04 09:45
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='HistoricalClient',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('first_name', models.CharField(max_length=64)),
                ('last_name', models.CharField(max_length=64)),
                ('dob', models.DateField(blank=True, help_text='Date of Birth', null=True)),
                ('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1, null=True)),
                ('address', models.CharField(blank=True, help_text='Street Address', max_length=128, null=True)),
                ('city', models.CharField(blank=True, max_length=64, null=True)),
                ('status', models.CharField(choices=[('NEW', 'New client'), ('TMP', 'Temp ID issued'), ('APP', 'Application submitted'), ('REG', 'Registered')], max_length=64, null=True)),
                ('newId', models.CharField(blank=True, max_length=32, null=True)),
                ('oldId', models.CharField(blank=True, max_length=32, null=True)),
                ('tempId', models.CharField(blank=True, max_length=32, null=True)),
                ('photo', models.TextField(max_length=100, null=True)),
                ('reg_notes', models.TextField(blank=True, default='', help_text='Registration notes', null=True)),
                ('notes', models.TextField(blank=True, default='', help_text='General notes', null=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-history_date', '-history_id'),
                'verbose_name': 'historical client',
                'get_latest_by': 'history_date',
            },
        ),
        migrations.CreateModel(
            name='HistoricalDependent',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('first_name', models.CharField(max_length=64)),
                ('last_name', models.CharField(max_length=64)),
                ('dob', models.DateField(blank=True, help_text='Date of Birth', null=True)),
                ('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1, null=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-history_date', '-history_id'),
                'verbose_name': 'historical dependent',
                'get_latest_by': 'history_date',
            },
        ),
        migrations.CreateModel(
            name='HistoricalVisit',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('visited_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-history_date', '-history_id'),
                'verbose_name': 'historical visit',
                'get_latest_by': 'history_date',
            },
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=64)),
                ('last_name', models.CharField(max_length=64)),
                ('dob', models.DateField(blank=True, help_text='Date of Birth', null=True)),
                ('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Visit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('visited_at', models.DateTimeField(default=django.utils.timezone.now)),
            ],
            options={
                'ordering': ['-visited_at', 'client'],
            },
        ),
        migrations.CreateModel(
            name='Client',
            fields=[
                ('person_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='clients.Person')),
                ('address', models.CharField(blank=True, help_text='Street Address', max_length=128, null=True)),
                ('city', models.CharField(blank=True, max_length=64, null=True)),
                ('status', models.CharField(choices=[('NEW', 'New client'), ('TMP', 'Temp ID issued'), ('APP', 'Application submitted'), ('REG', 'Registered')], max_length=64, null=True)),
                ('newId', models.CharField(blank=True, max_length=32, null=True)),
                ('oldId', models.CharField(blank=True, max_length=32, null=True)),
                ('tempId', models.CharField(blank=True, max_length=32, null=True)),
                ('photo', models.ImageField(null=True, upload_to='')),
                ('reg_notes', models.TextField(blank=True, default='', help_text='Registration notes', null=True)),
                ('notes', models.TextField(blank=True, default='', help_text='General notes', null=True)),
            ],
            bases=('clients.person',),
        ),
        migrations.CreateModel(
            name='Dependent',
            fields=[
                ('person_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='clients.Person')),
                ('dependent_on', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dependents', to='clients.Client')),
            ],
            bases=('clients.person',),
        ),
        migrations.AddField(
            model_name='historicaldependent',
            name='person_ptr',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='clients.Person'),
        ),
        migrations.AddField(
            model_name='historicalclient',
            name='person_ptr',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='clients.Person'),
        ),
        migrations.AddField(
            model_name='visit',
            name='client',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='visits', to='clients.Client'),
        ),
        migrations.AddField(
            model_name='visit',
            name='picked_up_by',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pickups', to='clients.Client'),
        ),
        migrations.AddField(
            model_name='historicalvisit',
            name='client',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='clients.Client'),
        ),
        migrations.AddField(
            model_name='historicalvisit',
            name='picked_up_by',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='clients.Client'),
        ),
        migrations.AddField(
            model_name='historicaldependent',
            name='dependent_on',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='clients.Client'),
        ),
    ]
