# Generated by Django 2.2.4 on 2019-08-05 17:00

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('common', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    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, verbose_name='Name')),
                ('subject', models.CharField(max_length=200, verbose_name='Subject')),
                ('web', models.URLField(blank=True, null=True, verbose_name='Web site')),
                ('people_img', models.ImageField(blank=True, null=True, upload_to='uploads/group/people_img', verbose_name='People')),
                ('logo_img', models.ImageField(blank=True, null=True, upload_to='uploads/group/group_img', verbose_name='Thumbnail')),
                ('description', models.TextField(blank=True, default='', null=True, verbose_name='Description')),
            ],
            options={
                'verbose_name': 'Group',
                'verbose_name_plural': 'Groups',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='GroupType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='Name')),
            ],
            options={
                'verbose_name': 'Group type',
                'verbose_name_plural': 'Group types',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Position',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=True, verbose_name='Active')),
                ('birthday', models.DateField(blank=True, null=True, verbose_name='Birthday')),
                ('gender', models.CharField(choices=[('F', 'Female'), ('M', 'Male')], max_length=1, verbose_name='Gender')),
                ('first_name', models.CharField(help_text='This field will appear in the website.', max_length=40, verbose_name='First name')),
                ('middle_name', models.CharField(blank=True, max_length=100, verbose_name='Middle name')),
                ('last_name', models.CharField(help_text='This field will appear in the website.', max_length=40, verbose_name='Last name')),
                ('full_name', models.CharField(max_length=150, verbose_name='Name')),
                ('email', models.EmailField(help_text='This field will appear in the website.', max_length=254, verbose_name='Research email')),
                ('web', models.URLField(blank=True, help_text='This field will appear in the website.', null=True, verbose_name='Website')),
                ('personal_email', models.EmailField(blank=True, max_length=254, null=True, verbose_name='Personal email')),
                ('phone_extension', models.IntegerField(blank=True, null=True, verbose_name='Phone extension')),
                ('phone_number', models.CharField(blank=True, help_text='This field will appear in the website if the next field is checked.', max_length=20, null=True, verbose_name='Contact')),
                ('emergency_contact', models.TextField(blank=True, default='', max_length=100, null=True, verbose_name='Emergency contacts')),
                ('biography', models.TextField(blank=True, default='', help_text='This field will appear in the website.', null=True, verbose_name='Biography')),
                ('curriculum_vitae', models.FileField(blank=True, help_text='This field will appear in the website.', null=True, upload_to='uploads/person/person_cv', verbose_name='Short Vitae')),
                ('img', models.ImageField(blank=True, help_text='This field will appear in the website.', max_length=150, upload_to='uploads/person/person_img', verbose_name='Picture')),
                ('room', models.CharField(blank=True, max_length=10, null=True, verbose_name='Room')),
                ('card_number', models.IntegerField(blank=True, null=True, verbose_name='Card number')),
                ('joined_date', models.DateField(blank=True, null=True, verbose_name='Joined date')),
                ('leave_date', models.DateField(blank=True, null=True, verbose_name='Leave date')),
                ('auth_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='person', to=settings.AUTH_USER_MODEL, verbose_name='User')),
                ('position', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='people.Position')),
            ],
            options={
                'verbose_name': 'Person',
                'verbose_name_plural': 'People',
                'ordering': ['first_name', 'last_name'],
                'permissions': (('app_access_hr', 'Access [Human Resources] app'), ('app_access_people', 'Access [People] app')),
            },
        ),
        migrations.CreateModel(
            name='InstitutionAffiliation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_joined', models.DateField(blank=True, null=True, verbose_name='Joined')),
                ('date_left', models.DateField(blank=True, null=True, verbose_name='Left')),
                ('institution', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='membership', to='common.Institution')),
                ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='membership', to='people.Person')),
            ],
        ),
        migrations.CreateModel(
            name='GroupMembership',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_joined', models.DateField(blank=True, null=True, verbose_name='Joined')),
                ('date_left', models.DateField(blank=True, null=True, verbose_name='Left')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='people.Group')),
                ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='people.Person')),
                ('position', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='people.Position')),
            ],
        ),
        migrations.AddField(
            model_name='group',
            name='members',
            field=models.ManyToManyField(through='people.GroupMembership', to='people.Person', verbose_name='Members'),
        ),
        migrations.AddField(
            model_name='group',
            name='responsible',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='Head', to='people.Person', verbose_name='Head'),
        ),
        migrations.AddField(
            model_name='group',
            name='type',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='people.GroupType', verbose_name='Type'),
        ),
    ]
