# Generated by Django 3.0.3 on 2020-04-03 10:49

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models
import uuid


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('project_core', '0114_makes_given_name_surname_not_unique_together_orcid_unique'),
    ]

    operations = [
        migrations.CreateModel(
            name='HistoricalProject',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('created_on', models.DateTimeField(blank=True, editable=False, help_text='Date and time at which the entry was created')),
                ('modified_on', models.DateTimeField(blank=True, editable=False, help_text='Date and time at which the entry was modified', null=True)),
                ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False)),
                ('title', models.CharField(help_text='Title of the project', max_length=500)),
                ('location', models.CharField(blank=True, help_text='Name of more precise location of where the project would take place (not coordinates)', max_length=200, null=True)),
                ('start_date', models.DateField(help_text='Date on which the project is expected to start')),
                ('end_date', models.DateField(help_text='Date on which the project is expected to end')),
                ('allocated_budget', models.DecimalField(decimal_places=2, help_text='Budget allocated to project', max_digits=10, null=True, validators=[django.core.validators.MinValueValidator(0)])),
                ('status', models.CharField(choices=[('Ongoing', 'Ongoing'), ('Completed', 'Completed'), ('Aborted', 'Aborted')], default='ONGOING', help_text='Status of a project', max_length=30)),
                ('abortion_reason', models.CharField(blank=True, help_text='Reason that a project was aborted', max_length=50, 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)),
                ('call', models.ForeignKey(blank=True, db_constraint=False, help_text='Call to which the project belongs', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='project_core.Call')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('overarching_project', models.ForeignKey(blank=True, db_constraint=False, help_text='Overarching project to which this project contributes', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='project_core.ExternalProject')),
                ('principal_investigator', models.ForeignKey(blank=True, db_constraint=False, help_text='Main applicant of the project', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='project_core.PersonPosition')),
                ('proposal', models.ForeignKey(blank=True, db_constraint=False, help_text='Proposal from which the project originates', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='project_core.Proposal')),
            ],
            options={
                'verbose_name': 'historical project',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
