# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-31 10:19
from __future__ import unicode_literals

import apps.survey.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('cms', '0016_auto_20160608_1535'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='LastResponse',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('data', models.TextField(blank=True, default=None, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='LocalFluSurvey',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField()),
                ('status', models.CharField(max_length=8)),
                ('age_user', models.SmallIntegerField()),
                ('data', models.TextField()),
                ('survey_id', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='LocalProfile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sq_num_season', models.SmallIntegerField(null=True)),
                ('sq_num_total', models.SmallIntegerField(null=True)),
                ('sq_date_first', models.DateField(null=True)),
                ('sq_date_last', models.DateField(null=True)),
                ('birth_date', models.DateField()),
                ('zip_code', models.CharField(max_length=5)),
                ('region', models.CharField(max_length=30, null=True)),
                ('gender', models.CharField(max_length=1)),
                ('a_family', models.SmallIntegerField()),
                ('a_smoker', models.CharField(max_length=1)),
                ('a_vaccine_prev_seasonal', models.CharField(max_length=1)),
                ('a_vaccine_prev_swine', models.CharField(max_length=1)),
                ('a_vaccine_current', models.CharField(max_length=1)),
            ],
        ),
        migrations.CreateModel(
            name='LocalResponse',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField()),
                ('user_id', models.CharField(max_length=36)),
                ('survey_id', models.CharField(max_length=50)),
                ('answers', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Participation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('epidb_id', models.CharField(max_length=36, null=True)),
                ('previous_participation_date', models.DateTimeField(null=True)),
                ('previous_participation', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='survey.Participation')),
            ],
            options={
                'verbose_name_plural': 'Survey participation log',
            },
        ),
        migrations.CreateModel(
            name='Profile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(default=None, null=True)),
                ('updated', models.DateTimeField(default=None, null=True)),
                ('valid', models.BooleanField(default=False)),
                ('data', models.TextField(blank=True, default=None, null=True)),
            ],
            options={
                'verbose_name_plural': 'User profile',
            },
        ),
        migrations.CreateModel(
            name='ProfileSendQueue',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField()),
                ('user_id', models.CharField(max_length=36)),
                ('survey_id', models.CharField(max_length=50)),
                ('answers', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='ResponseSendQueue',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('user_id', models.CharField(max_length=36)),
                ('survey_id', models.CharField(max_length=50)),
                ('answers', models.TextField()),
                ('participation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='survey.Participation')),
            ],
        ),
        migrations.CreateModel(
            name='Survey',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('survey_id', models.CharField(max_length=50, unique=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True, null=True)),
                ('specification', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='SurveyIdCode',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('idcode', models.CharField(max_length=10, unique=True)),
                ('fodelsedatum', models.CharField(blank=True, max_length=10, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='SurveyListPlugin',
            fields=[
                ('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='survey_surveylistplugin', serialize=False, to='cms.CMSPlugin')),
            ],
            options={
                'abstract': False,
            },
            bases=('cms.cmsplugin',),
        ),
        migrations.CreateModel(
            name='SurveyResposeDraft',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('global_id', models.CharField(max_length=36)),
                ('survey_id', models.IntegerField()),
                ('timestamp', models.IntegerField()),
                ('form_data', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='SurveyUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('global_id', models.CharField(default=apps.survey.models.create_global_id, max_length=36, unique=True)),
                ('last_participation_date', models.DateTimeField(blank=True, null=True)),
                ('name', models.CharField(max_length=100)),
                ('deleted', models.BooleanField(default=False)),
                ('last_participation', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='survey.Participation')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'User',
            },
        ),
        migrations.AddField(
            model_name='surveyidcode',
            name='surveyuser_global_id',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='survey.SurveyUser', to_field='global_id'),
        ),
        migrations.AddField(
            model_name='profilesendqueue',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='survey.SurveyUser'),
        ),
        migrations.AddField(
            model_name='profile',
            name='survey',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='survey.Survey'),
        ),
        migrations.AddField(
            model_name='profile',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='survey.SurveyUser', unique=True),
        ),
        migrations.AddField(
            model_name='participation',
            name='survey',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='survey.Survey'),
        ),
        migrations.AddField(
            model_name='participation',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='survey.SurveyUser'),
        ),
        migrations.AddField(
            model_name='localprofile',
            name='surveyuser',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='survey.SurveyUser', unique=True),
        ),
        migrations.AddField(
            model_name='localflusurvey',
            name='surveyuser',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='survey.SurveyUser'),
        ),
        migrations.AddField(
            model_name='lastresponse',
            name='participation',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='survey.Participation'),
        ),
        migrations.AddField(
            model_name='lastresponse',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='survey.SurveyUser', unique=True),
        ),
    ]
