# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import django_extensions.db.fields
from django.conf import settings


class Migration(migrations.Migration):

    dependencies = [
        ('sync', '__first__'),
        ('trainings', '__first__'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(primary_key=True, blank=True, editable=False, serialize=False)),
                ('text', models.TextField(blank=True)),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Choice',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(primary_key=True, blank=True, editable=False, serialize=False)),
                ('label', models.CharField(max_length=500)),
                ('detail', models.CharField(max_length=500)),
                ('value_number', models.IntegerField(null=True, blank=True)),
                ('value_text', models.CharField(max_length=500, blank=True, null=True)),
                ('first_update', models.ForeignKey(related_name='choice_by_first', null=True, blank=True, to='sync.Update')),
                ('last_update', models.ForeignKey(related_name='choice_by_last', null=True, blank=True, to='sync.Update')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Pool',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(primary_key=True, blank=True, editable=False, serialize=False)),
                ('name', models.CharField(max_length=500)),
                ('description', models.TextField(blank=True)),
                ('is_global', models.BooleanField(default=False)),
                ('is_mandatory', models.BooleanField(default=True)),
                ('author', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
                ('first_update', models.ForeignKey(related_name='pool_by_first', null=True, blank=True, to='sync.Update')),
                ('last_update', models.ForeignKey(related_name='pool_by_last', null=True, blank=True, to='sync.Update')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(primary_key=True, blank=True, editable=False, serialize=False)),
                ('title', models.CharField(max_length=500, help_text='Short title of the question')),
                ('details', models.TextField(help_text='Detailled question', blank=True)),
                ('question_type', models.CharField(default='s', choices=[('o', 'Open question'), ('s', 'Multiple answers, unique choice'), ('m', 'Multiple answers, multiple choice')], max_length=1, help_text='Question type')),
                ('value_type', models.CharField(default='p', choices=[(None, 'No score'), ('p', 'Percentage'), ('n', 'Number'), ('t', 'Text')], max_length=1, help_text='Type of value for the choices')),
                ('first_update', models.ForeignKey(related_name='question_by_first', null=True, blank=True, to='sync.Update')),
                ('last_update', models.ForeignKey(related_name='question_by_last', null=True, blank=True, to='sync.Update')),
                ('pool', models.ForeignKey(related_name='questions', to='surveys.Pool')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Survey',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(primary_key=True, blank=True, editable=False, serialize=False)),
                ('first_update', models.ForeignKey(related_name='survey_by_first', null=True, blank=True, to='sync.Update')),
                ('last_update', models.ForeignKey(related_name='survey_by_last', null=True, blank=True, to='sync.Update')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='SurveyPool',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(primary_key=True, blank=True, editable=False, serialize=False)),
                ('is_displayed', models.BooleanField(default=True)),
                ('is_new', models.BooleanField(default=False)),
                ('first_update', models.ForeignKey(related_name='surveypool_by_first', null=True, blank=True, to='sync.Update')),
                ('last_update', models.ForeignKey(related_name='surveypool_by_last', null=True, blank=True, to='sync.Update')),
                ('pool', models.ForeignKey(to='surveys.Pool')),
                ('survey', models.ForeignKey(to='surveys.Survey')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.AddField(
            model_name='survey',
            name='pools',
            field=models.ManyToManyField(through='surveys.SurveyPool', to='surveys.Pool'),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='survey',
            name='trainer',
            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='survey',
            name='training',
            field=models.ForeignKey(to='trainings.Training'),
            preserve_default=True,
        ),
        migrations.AlterUniqueTogether(
            name='survey',
            unique_together=set([('training', 'trainer')]),
        ),
        migrations.AddField(
            model_name='choice',
            name='question',
            field=models.ForeignKey(related_name='choices', to='surveys.Question'),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='answer',
            name='choices',
            field=models.ManyToManyField(to='surveys.Choice'),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='answer',
            name='first_update',
            field=models.ForeignKey(related_name='answer_by_first', null=True, blank=True, to='sync.Update'),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='answer',
            name='last_update',
            field=models.ForeignKey(related_name='answer_by_last', null=True, blank=True, to='sync.Update'),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='answer',
            name='question',
            field=models.ForeignKey(to='surveys.Question'),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='answer',
            name='survey',
            field=models.ForeignKey(to='surveys.Survey'),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='answer',
            name='trainee',
            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='answer',
            name='training_session',
            field=models.ForeignKey(to='trainings.TrainingSession'),
            preserve_default=True,
        ),
    ]
