# Generated by Django 2.2.13 on 2020-10-12 12:25

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


class Migration(migrations.Migration):

    dependencies = [
        ('per', '0021_auto_20200903_0843'),
    ]

    operations = [
        migrations.CreateModel(
            name='FormAnswer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.CharField(max_length=40, verbose_name='text')),
            ],
        ),
        migrations.CreateModel(
            name='FormArea',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=250, verbose_name='title')),
                ('area_num', models.IntegerField(default=1, verbose_name='area number')),
            ],
        ),
        migrations.CreateModel(
            name='FormComponent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=250, verbose_name='title')),
                ('component_num', models.IntegerField(default=1, verbose_name='component number')),
                ('description', models.TextField(blank=True, null=True, verbose_name='description')),
                ('area', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='per.FormArea', verbose_name='area')),
            ],
        ),
        migrations.CreateModel(
            name='FormQuestion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('question', models.CharField(max_length=500, verbose_name='question')),
                ('question_num', models.IntegerField(default=1, verbose_name='question number')),
                ('answers', models.ManyToManyField(blank=True, to='per.FormAnswer', verbose_name='districts')),
                ('component', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='per.FormComponent', verbose_name='component')),
            ],
        ),
        migrations.AlterModelOptions(
            name='form',
            options={'ordering': ('area', 'created_at'), 'verbose_name': 'Form', 'verbose_name_plural': 'Forms'},
        ),
        migrations.AlterModelOptions(
            name='formdata',
            options={'ordering': ('form', 'question__question_num'), 'verbose_name': 'Form Data', 'verbose_name_plural': 'Form Data'},
        ),
        migrations.RemoveField(
            model_name='form',
            name='code',
        ),
        migrations.RemoveField(
            model_name='form',
            name='ended_at',
        ),
        migrations.RemoveField(
            model_name='form',
            name='finalized',
        ),
        migrations.RemoveField(
            model_name='form',
            name='ip_address',
        ),
        migrations.RemoveField(
            model_name='form',
            name='name',
        ),
        migrations.RemoveField(
            model_name='form',
            name='ns',
        ),
        migrations.RemoveField(
            model_name='form',
            name='started_at',
        ),
        migrations.RemoveField(
            model_name='form',
            name='submitted_at',
        ),
        migrations.RemoveField(
            model_name='form',
            name='unique_id',
        ),
        migrations.RemoveField(
            model_name='form',
            name='validated',
        ),
        migrations.RemoveField(
            model_name='formdata',
            name='question_id',
        ),
        migrations.RemoveField(
            model_name='formdata',
            name='selected_option',
        ),
        migrations.AddField(
            model_name='form',
            name='is_draft',
            field=models.BooleanField(default=True, verbose_name='is draft'),
        ),
        migrations.AddField(
            model_name='form',
            name='is_finalized',
            field=models.BooleanField(default=False, verbose_name='is finalized'),
        ),
        migrations.AddField(
            model_name='form',
            name='is_validated',
            field=models.BooleanField(default=False, verbose_name='is validated'),
        ),
        migrations.AlterField(
            model_name='formdata',
            name='notes',
            field=models.TextField(blank=True, null=True, verbose_name='notes'),
        ),
        migrations.DeleteModel(
            name='Draft',
        ),
        migrations.AddField(
            model_name='form',
            name='area',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='per.FormArea', verbose_name='area'),
        ),
        migrations.AddField(
            model_name='formdata',
            name='question',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='per.FormQuestion', verbose_name='question'),
        ),
        migrations.AddField(
            model_name='formdata',
            name='selected_answer',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='per.FormAnswer', verbose_name='answer'),
        ),
    ]
