# Generated by Django 4.0.1 on 2022-02-01 18:00

from django.conf import settings
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import people.models
import people.utils.variable_res_date


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('maiden_name', models.CharField(blank=True, max_length=128, null=True, verbose_name='maiden name')),
                ('nickname', models.CharField(blank=True, max_length=128, null=True, verbose_name='nickname')),
                ('gender', models.IntegerField(choices=[(1, 'Male'), (2, 'Female'), (3, 'Other')], default=3, verbose_name='gender')),
                ('birth_date', people.utils.variable_res_date.VariableResolutionDateField(blank=True, null=True, verbose_name='birth date')),
                ('death_date', people.utils.variable_res_date.VariableResolutionDateField(blank=True, null=True, verbose_name='death date')),
                ('visible', models.BooleanField(default=False, verbose_name='visible')),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'person',
                'verbose_name_plural': 'people',
                'ordering': ('-birth_date',),
                'unique_together': {('first_name', 'last_name', 'nickname')},
            },
            managers=[
                ('objects', people.models.PersonManager()),
            ],
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('category', models.IntegerField(choices=[(1, 'Elementary school'), (2, 'High school'), (3, 'University'), (4, 'Seminar'), (5, 'Other')], verbose_name='category')),
                ('name', models.CharField(max_length=256, unique=True, verbose_name='name')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='people.group', verbose_name='parent')),
            ],
            options={
                'ordering': ('name',),
            },
        ),
        migrations.CreateModel(
            name='GroupMembership',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_started', people.utils.variable_res_date.VariableResolutionDateField(blank=True, null=True, verbose_name='date start')),
                ('date_ended', people.utils.variable_res_date.VariableResolutionDateField(blank=True, null=True, verbose_name='date end')),
                ('visible', models.BooleanField(default=False, verbose_name='visible')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='memberships', to='people.group', verbose_name='group')),
                ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='memberships', to=settings.AUTH_USER_MODEL, verbose_name='person')),
            ],
            options={
                'ordering': ('-date_started',),
                'unique_together': {('person', 'group')},
            },
        ),
        migrations.CreateModel(
            name='Relationship',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='relationships_as_first', to=settings.AUTH_USER_MODEL, verbose_name='first person')),
                ('second_person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='relationships_as_second', to=settings.AUTH_USER_MODEL, verbose_name='second person')),
            ],
            options={
                'unique_together': {('first_person', 'second_person')},
            },
        ),
        migrations.CreateModel(
            name='RelationshipStatus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.IntegerField(choices=[(1, 'Blood relatives'), (2, 'Siblings'), (3, 'Parent-child'), (4, 'Married'), (5, 'Engaged'), (6, 'Dating'), (7, 'Rumour')], verbose_name='status')),
                ('date_start', people.utils.variable_res_date.VariableResolutionDateField(blank=True, null=True, verbose_name='date start')),
                ('date_end', people.utils.variable_res_date.VariableResolutionDateField(blank=True, null=True, verbose_name='date end')),
                ('confirmed_by', models.IntegerField(choices=[(0, 'Awaiting approval from both people in the relationship'), (1, 'Confirmed by the first person'), (2, 'Confirmed by the second person'), (3, 'Confirmed by both people')], default=0, verbose_name='confirmed by')),
                ('visible', models.BooleanField(default=False, verbose_name='visible')),
                ('relationship', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='statuses', to='people.relationship', verbose_name='relationship')),
            ],
            options={
                'verbose_name_plural': 'relationship statuses',
                'ordering': ('-date_start',),
                'get_latest_by': ('date_end', 'date_start'),
            },
        ),
        migrations.CreateModel(
            name='RelationshipStatusNote',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField()),
                ('type', models.IntegerField(choices=[(1, 'Public note'), (2, 'Private note')], verbose_name='type')),
                ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='date created')),
                ('reason', models.IntegerField(choices=[(1, 'Note on relationship start'), (2, 'Note on relationship end'), (3, 'Unspecified reason')], verbose_name='reason')),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='created by')),
                ('status', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='people.relationshipstatus', verbose_name='status')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PersonNote',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField()),
                ('type', models.IntegerField(choices=[(1, 'Public note'), (2, 'Private note')], verbose_name='type')),
                ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='date created')),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='created by')),
                ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ManagementAuthority',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('manager', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='manager')),
                ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='managers', to=settings.AUTH_USER_MODEL, verbose_name='subject')),
            ],
        ),
        migrations.CreateModel(
            name='GroupMembershipNote',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField()),
                ('type', models.IntegerField(choices=[(1, 'Public note'), (2, 'Private note')], verbose_name='type')),
                ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='date created')),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='created by')),
                ('membership', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='people.groupmembership', verbose_name='membership')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
