# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-17 11:42
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('answer_text', models.TextField(blank=True)),
                ('answer_key', models.TextField(blank=True)),
                ('answer_int', models.IntegerField(blank=True, null=True)),
                ('answer_float', models.FloatField(blank=True, null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='AnswerGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('token', models.CharField(max_length=40)),
                ('object_id', models.PositiveIntegerField(default=0)),
                ('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
            options={
                'verbose_name': 'Answer Group',
            },
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('text', models.TextField(blank=True)),
                ('field_key', models.CharField(choices=[('tx', 'Text'), ('mt', 'MultiText'), ('dr', 'Dropdown'), ('rd', 'Radio'), ('ch', 'Checkboxes'), ('rt', 'Rating'), ('in', 'Integer'), ('fl', 'Float')], max_length=2)),
                ('field_parms', jsonfield.fields.JSONField(blank=True, default={})),
                ('required', models.BooleanField(default=False)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='QuestionOrder',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('rank', models.PositiveSmallIntegerField(db_index=True)),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dform.Question')),
            ],
            options={
                'verbose_name': 'Question Order',
                'ordering': ['survey_version__id', 'rank'],
                'verbose_name_plural': 'Question Order',
            },
        ),
        migrations.CreateModel(
            name='Survey',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('name', models.CharField(max_length=50)),
                ('token', models.CharField(max_length=40)),
                ('success_redirect', models.TextField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SurveyVersion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('version_num', models.PositiveSmallIntegerField(default=1)),
                ('success_redirect', models.TextField(blank=True)),
                ('survey', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dform.Survey')),
            ],
            options={
                'verbose_name': 'Survey Version',
            },
        ),
        migrations.AddField(
            model_name='questionorder',
            name='survey_version',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dform.SurveyVersion'),
        ),
        migrations.AddField(
            model_name='question',
            name='survey',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dform.Survey'),
        ),
        migrations.AddField(
            model_name='question',
            name='survey_versions',
            field=models.ManyToManyField(to='dform.SurveyVersion'),
        ),
        migrations.AddField(
            model_name='answergroup',
            name='survey_version',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dform.SurveyVersion'),
        ),
        migrations.AddField(
            model_name='answer',
            name='answer_group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dform.AnswerGroup'),
        ),
        migrations.AddField(
            model_name='answer',
            name='question',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dform.Question'),
        ),
    ]
