# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-07-11 12:03
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('submission', '0001_initial'),
        ('core', '0001_initial'),
        ('journal', '0002_auto_20170711_1203'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='DecisionDraft',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('decision', models.CharField(choices=[('accept', 'Accept Without Revisions'), ('minor_revisions', 'Minor Revisions Required'), ('major_revisions', 'Major Revisions Required'), ('reject', 'Reject')], max_length=100)),
                ('message_to_editor', models.TextField(blank=True, null=True)),
                ('email_message', models.TextField(blank=True, null=True)),
                ('drafted', models.DateTimeField(auto_now=True)),
                ('editor_decision', models.CharField(blank=True, choices=[('accept', 'Accept'), ('decline', 'Decline')], max_length=20, null=True)),
                ('closed', models.BooleanField(default=False)),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='submission.Article')),
                ('section_editor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='draft_section_editor', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='EditorAssignment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('editor_type', models.CharField(choices=[('editor', 'Editor'), ('section-editor', 'Section Editor')], max_length=20)),
                ('assigned', models.DateTimeField(default=django.utils.timezone.now)),
                ('notified', models.BooleanField(default=False)),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='submission.Article')),
                ('editor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='EditorOverride',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('overwritten', models.DateTimeField(default=django.utils.timezone.now)),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='submission.Article')),
                ('editor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ReviewAssignment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('decision', models.CharField(blank=True, choices=[('accept', 'Accept Without Revisions'), ('minor_revisions', 'Minor Revisions Required'), ('major_revisions', 'Major Revisions Required'), ('reject', 'Reject')], max_length=20, null=True)),
                ('competing_interests', models.TextField(blank=True, help_text="If any of the authors or editors have any competing interests please add them here. EG. 'This study was paid for by corp xyz.'.", null=True)),
                ('review_type', models.CharField(choices=[('traditional', 'Traditional'), ('annotation', 'Annotation')], default='traditional', help_text='Traditional review uses a form set, annotation review is freeform using hypothes.is', max_length=20)),
                ('visibility', models.CharField(choices=[('open', 'Open'), ('blind', 'Blind'), ('double-blind', 'Double Blind')], default='blind', max_length=20)),
                ('access_code', models.CharField(blank=True, max_length=100, null=True)),
                ('date_requested', models.DateTimeField(auto_now_add=True)),
                ('date_due', models.DateField()),
                ('date_accepted', models.DateTimeField(blank=True, null=True)),
                ('date_declined', models.DateTimeField(blank=True, null=True)),
                ('date_complete', models.DateTimeField(blank=True, null=True)),
                ('date_reminded', models.DateField(blank=True, null=True)),
                ('is_complete', models.BooleanField(default=False)),
                ('for_author_consumption', models.BooleanField(default=False)),
                ('suggested_reviewers', models.TextField(blank=True, null=True)),
                ('comments_for_editor', models.TextField(blank=True, help_text='If you have any comments for the Editor you can add them here,                                            these will not be shared with the Author.', null=True, verbose_name='Comments for the Editor')),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='submission.Article')),
                ('editor', models.ForeignKey(help_text='Editor requesting the review', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='editor', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ReviewAssignmentAnswer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('answer', models.TextField()),
                ('edited_answer', models.TextField(blank=True, null=True)),
                ('author_can_see', models.BooleanField(default=True)),
                ('assignment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='review.ReviewAssignment')),
            ],
        ),
        migrations.CreateModel(
            name='ReviewerRating',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('rating', models.IntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(10)])),
                ('assignment', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='review.ReviewAssignment')),
                ('rater', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ReviewForm',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('slug', models.SlugField(max_length=200)),
                ('intro', models.TextField(help_text='Message displayed at the start of the review form.')),
                ('thanks', models.TextField(help_text='Message displayed after the reviewer is finished.')),
            ],
        ),
        migrations.CreateModel(
            name='ReviewFormAnswer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('answer', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='ReviewFormElement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('kind', models.CharField(choices=[('text', 'Text Field'), ('textarea', 'Text Area'), ('check', 'Check Box'), ('select', 'Select'), ('email', 'Email'), ('upload', 'Upload'), ('date', 'Date')], max_length=50)),
                ('choices', models.CharField(blank=True, help_text='Seperate choices with the bar | character.', max_length=1000, null=True)),
                ('required', models.BooleanField(default=True)),
                ('order', models.IntegerField()),
                ('width', models.CharField(choices=[('large-4 columns', 'third'), ('large-6 columns', 'half'), ('large-12 columns', 'full')], max_length=20)),
                ('help_text', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='ReviewRound',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('round_number', models.IntegerField()),
                ('date_started', models.DateTimeField(auto_now_add=True)),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='submission.Article')),
                ('review_files', models.ManyToManyField(to='core.File')),
            ],
            options={
                'ordering': ('-round_number',),
            },
        ),
        migrations.CreateModel(
            name='RevisionAction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField()),
                ('logged', models.DateTimeField(blank=True, default=None, null=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='RevisionRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('editor_note', models.TextField()),
                ('author_note', models.TextField(blank=True, null=True, verbose_name='Covering Letter')),
                ('type', models.CharField(choices=[('minor_revisions', 'Minor Revisions'), ('major_revisions', 'Major Revisions')], default='minor_revisions', max_length=20)),
                ('date_requested', models.DateField(default=django.utils.timezone.now)),
                ('date_due', models.DateField()),
                ('date_completed', models.DateTimeField(blank=True, null=True)),
                ('actions', models.ManyToManyField(to='review.RevisionAction')),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='submission.Article')),
                ('editor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='reviewformanswer',
            name='form_element',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='review.ReviewFormElement'),
        ),
        migrations.AddField(
            model_name='reviewformanswer',
            name='review_assignment',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='review.ReviewAssignment'),
        ),
        migrations.AddField(
            model_name='reviewform',
            name='elements',
            field=models.ManyToManyField(to='review.ReviewFormElement'),
        ),
        migrations.AddField(
            model_name='reviewform',
            name='journal',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='journal.Journal'),
        ),
        migrations.AddField(
            model_name='reviewassignmentanswer',
            name='element',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='review.ReviewFormElement'),
        ),
        migrations.AddField(
            model_name='reviewassignment',
            name='form',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='review.ReviewForm'),
        ),
        migrations.AddField(
            model_name='reviewassignment',
            name='review_file',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.File'),
        ),
        migrations.AddField(
            model_name='reviewassignment',
            name='review_round',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='review.ReviewRound'),
        ),
        migrations.AddField(
            model_name='reviewassignment',
            name='reviewer',
            field=models.ForeignKey(help_text='User to undertake the review', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewer', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterUniqueTogether(
            name='reviewround',
            unique_together=set([('article', 'round_number')]),
        ),
        migrations.AlterUniqueTogether(
            name='editorassignment',
            unique_together=set([('article', 'editor')]),
        ),
    ]
