# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-19 15:37
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Batch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(db_index=True, default=True)),
                ('allotted_assignment_time', models.IntegerField(default=24)),
                ('assignments_per_task', models.IntegerField(default=1, verbose_name='Assignments per Task')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('filename', models.CharField(max_length=1024)),
                ('name', models.CharField(max_length=1024)),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Batch',
                'verbose_name_plural': 'Batches',
            },
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(db_index=True, default=True)),
                ('assignments_per_task', models.IntegerField(db_index=True, default=1)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('custom_permissions', models.BooleanField(default=False)),
                ('filename', models.CharField(blank=True, max_length=1024)),
                ('html_template', models.TextField()),
                ('html_template_has_submit_button', models.BooleanField(default=False)),
                ('login_required', models.BooleanField(db_index=True, default=True)),
                ('name', models.CharField(max_length=1024)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('fieldnames', jsonfield.fields.JSONField(blank=True)),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='created_projects', to=settings.AUTH_USER_MODEL)),
                ('updated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='updated_projects', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Project',
                'permissions': (('can_work_on', 'Can work on Tasks for this Project'),),
            },
        ),
        migrations.CreateModel(
            name='Task',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('completed', models.BooleanField(default=False)),
                ('input_csv_fields', jsonfield.fields.JSONField()),
                ('batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='turkle.Batch')),
            ],
            options={
                'verbose_name': 'Task',
            },
        ),
        migrations.CreateModel(
            name='TaskAssignment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('answers', jsonfield.fields.JSONField(blank=True)),
                ('completed', models.BooleanField(db_index=True, default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('expires_at', models.DateTimeField(null=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('assigned_to', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='turkle.Task')),
            ],
            options={
                'verbose_name': 'Task Assignment',
            },
        ),
        migrations.AddField(
            model_name='batch',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='turkle.Project'),
        ),
    ]
