# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-29 07:52
from __future__ import unicode_literals

import b24online.custom
import b24online.models
import b24online.utils
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid


class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('centerpokupok', '0002_b2cproduct_producer'),
        ('b24online', '0006_auto_20160311_1218'),
    ]

    operations = [
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(db_index=True, default=django.utils.timezone.now, verbose_name='Creation time')),
                ('updated_at', models.DateTimeField(auto_now=True, null=True, verbose_name='Update time')),
                ('answer', models.NullBooleanField(default=False, verbose_name='Answer')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='answer_create_user', to=settings.AUTH_USER_MODEL, verbose_name='Creator')),
            ],
            options={
                'verbose_name': 'Question answer',
                'verbose_name_plural': 'Questions answers',
            },
            bases=(b24online.models.ActiveModelMixing, models.Model),
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(db_index=True, default=django.utils.timezone.now, verbose_name='Creation time')),
                ('updated_at', models.DateTimeField(auto_now=True, null=True, verbose_name='Update time')),
                ('who_created', models.CharField(blank=True, choices=[('author', 'By author'), ('member', 'By member')], default='author', max_length=10, null=True, verbose_name='Who is the author')),
                ('question_text', models.TextField(verbose_name='Question text')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Descripion')),
                ('position', models.PositiveIntegerField(blank=True, null=True, verbose_name='The question position in the set')),
                ('is_active', models.BooleanField(default=True)),
                ('is_deleted', models.BooleanField(default=False)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='question_create_user', to=settings.AUTH_USER_MODEL, verbose_name='Creator')),
            ],
            options={
                'verbose_name': 'Question',
                'verbose_name_plural': 'Questions',
            },
            bases=(b24online.models.ActiveModelMixing, models.Model),
        ),
        migrations.CreateModel(
            name='Questionnaire',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(db_index=True, default=django.utils.timezone.now, verbose_name='Creation time')),
                ('updated_at', models.DateTimeField(auto_now=True, null=True, verbose_name='Update time')),
                ('name', models.CharField(max_length=255, verbose_name='Questionnaire title')),
                ('short_description', models.TextField(blank=True, null=True, verbose_name='Short description')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Descripion')),
                ('image', b24online.custom.CustomImageField(blank=True, max_length=255, null=True, storage=b24online.custom.S3ImageStorage(), upload_to=b24online.utils.generate_upload_path)),
                ('object_id', models.PositiveIntegerField()),
                ('is_active', models.BooleanField(default=True)),
                ('is_deleted', models.BooleanField(default=False)),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='questionnaire_create_user', to=settings.AUTH_USER_MODEL, verbose_name='Creator')),
                ('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='questionnaire_update_user', to=settings.AUTH_USER_MODEL, verbose_name='Editor')),
            ],
            options={
                'verbose_name': 'Questionnaire',
                'verbose_name_plural': 'Questionnaires',
            },
            bases=(b24online.models.ActiveModelMixing, models.Model),
        ),
        migrations.CreateModel(
            name='QuestionnaireCase',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(db_index=True, default=django.utils.timezone.now, verbose_name='Creation time')),
                ('updated_at', models.DateTimeField(auto_now=True, null=True, verbose_name='Update time')),
                ('case_uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('ready', 'Ready'), ('active', 'Actiive'), ('FINISHED', 'Finished')], db_index=True, default='draft', editable=False, max_length=20, verbose_name='Status')),
                ('is_active', models.BooleanField(default=True)),
                ('is_deleted', models.BooleanField(default=False)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='questionnairecase_create_user', to=settings.AUTH_USER_MODEL, verbose_name='Creator')),
                ('extra_questions', models.ManyToManyField(to='b24online.Question')),
            ],
            options={
                'verbose_name': 'Questionnaire case',
                'verbose_name_plural': 'Questionnaire cases',
            },
            bases=(b24online.models.ActiveModelMixing, models.Model),
        ),
        migrations.CreateModel(
            name='QuestionnaireParticipant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email', models.EmailField(db_index=True, max_length=255, verbose_name='E-mail')),
                ('is_invited', models.BooleanField(default=False)),
                ('is_active', models.BooleanField(default=True)),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='questionnaire_cases', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Questionnaire participant',
                'verbose_name_plural': 'Questionnaire participants',
            },
            bases=(b24online.models.ActiveModelMixing, models.Model),
        ),
        migrations.CreateModel(
            name='Recommendation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(db_index=True, default=django.utils.timezone.now, verbose_name='Creation time')),
                ('updated_at', models.DateTimeField(auto_now=True, null=True, verbose_name='Update time')),
                ('name', models.CharField(blank=True, max_length=255, null=True, verbose_name='Name')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Descripion')),
                ('is_active', models.BooleanField(default=True)),
                ('is_deleted', models.BooleanField(default=False)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='recommendation_create_user', to=settings.AUTH_USER_MODEL, verbose_name='Creator')),
                ('question', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='recommendations', to='b24online.Question')),
                ('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='recommendation_update_user', to=settings.AUTH_USER_MODEL, verbose_name='Editor')),
            ],
            options={
                'verbose_name': 'Recommendation',
                'verbose_name_plural': 'Recommendations',
            },
            bases=(b24online.models.ActiveModelMixing, models.Model),
        ),
        migrations.AddField(
            model_name='producer',
            name='b2b_categories',
            field=models.ManyToManyField(related_name='producers', to='b24online.B2BProductCategory'),
        ),
        migrations.AddField(
            model_name='producer',
            name='b2c_categories',
            field=models.ManyToManyField(related_name='producers', to='centerpokupok.B2CProductCategory'),
        ),
        migrations.AddField(
            model_name='producer',
            name='is_active',
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name='producer',
            name='is_approved',
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name='producer',
            name='is_deleted',
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name='questionnairecase',
            name='participants',
            field=models.ManyToManyField(to='b24online.QuestionnaireParticipant'),
        ),
        migrations.AddField(
            model_name='questionnairecase',
            name='questionnaire',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cases', to='b24online.Questionnaire'),
        ),
        migrations.AddField(
            model_name='questionnairecase',
            name='recommendations',
            field=models.ManyToManyField(to='b24online.Recommendation'),
        ),
        migrations.AddField(
            model_name='questionnairecase',
            name='updated_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='questionnairecase_update_user', to=settings.AUTH_USER_MODEL, verbose_name='Editor'),
        ),
        migrations.AddField(
            model_name='question',
            name='questionnaire',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='questions', to='b24online.Questionnaire'),
        ),
        migrations.AddField(
            model_name='question',
            name='updated_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='question_update_user', to=settings.AUTH_USER_MODEL, verbose_name='Editor'),
        ),
        migrations.AddField(
            model_name='answer',
            name='participant',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='b24online.QuestionnaireParticipant', verbose_name='Answer author'),
        ),
        migrations.AddField(
            model_name='answer',
            name='question',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='questions', to='b24online.Question', verbose_name='Question'),
        ),
        migrations.AddField(
            model_name='answer',
            name='questionnaire_case',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='questionnaire_cases', to='b24online.QuestionnaireCase', verbose_name='Questionnaire cases'),
        ),
        migrations.AddField(
            model_name='answer',
            name='updated_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='answer_update_user', to=settings.AUTH_USER_MODEL, verbose_name='Editor'),
        ),
    ]
