# Generated by Django 2.1.7 on 2019-03-12 10:31

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("hipeac", "0024_event_presentation"),
    ]

    operations = [
        migrations.CreateModel(
            name="Internship",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("title", models.CharField(max_length=250)),
                ("slug", models.SlugField(editable=False, max_length=250)),
                ("description", models.TextField()),
                (
                    "timing",
                    models.CharField(
                        help_text="Describe the duration and the periods of the Internship.", max_length=400
                    ),
                ),
                ("location", models.CharField(help_text="Where will the PhD student be working?", max_length=250)),
                ("country", django_countries.fields.CountryField(max_length=2)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
            ],
            options={"ordering": ["-created_at"]},
        ),
        migrations.CreateModel(
            name="InternshipApplication",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "status",
                    models.CharField(
                        choices=[("UN", "Pending"), ("OK", "Accepted"), ("NO", "Rejected")], default="UN", max_length=2
                    ),
                ),
                (
                    "host_decision",
                    models.CharField(
                        choices=[("UN", "Pending"), ("OK", "Accepted"), ("NO", "Rejected")], default="UN", max_length=2
                    ),
                ),
                ("rank", models.SmallIntegerField(default=0)),
                ("comments", models.TextField()),
                ("available_from", models.DateField(help_text="YYYY-MM-DD")),
                ("available_to", models.DateField(help_text="YYYY-MM-DD")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "summary",
                    models.TextField(blank=True, help_text="Summary sent by the student to HiPEAC.", null=True),
                ),
                (
                    "advisor_string",
                    models.CharField(
                        blank=True,
                        help_text="Fill in your advisors's name here.",
                        max_length=250,
                        null=True,
                        verbose_name="Advisor",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="internship_applications",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "internship",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="applications", to="hipeac.Internship"
                    ),
                ),
            ],
            options={"ordering": ["-created_at"]},
        ),
        migrations.CreateModel(
            name="InternshipCall",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("start_date", models.DateField()),
                ("internship_deadline", models.DateField(verbose_name="Deadline for submitting internships")),
                ("application_deadline", models.DateField(verbose_name="Deadline for submitting applications")),
                ("end_date", models.DateField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "is_frozen",
                    models.BooleanField(
                        default=False, help_text="Check this box to avoid further editing on applications or reviews."
                    ),
                ),
                (
                    "manager",
                    models.ForeignKey(
                        limit_choices_to={"membership_tags__contains": "member"},
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="managed_internships",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={"ordering": ["-start_date"]},
        ),
        migrations.CreateModel(
            name="InternshipReview",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("comments", models.TextField()),
                ("feedback", models.TextField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "application",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="collaborations",
                        to="hipeac.InternshipApplication",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="internship_reviews",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="internship",
            name="call",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, related_name="internships", to="hipeac.InternshipCall"
            ),
        ),
        migrations.AddField(
            model_name="internship",
            name="created_by",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="posted_phd_internships",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="internship",
            name="institution",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="internships",
                to="hipeac.Institution",
            ),
        ),
        migrations.AlterUniqueTogether(name="internshipapplication", unique_together={("internship", "created_by")},),
    ]
