# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-03-07 12:44
from __future__ import unicode_literals

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

import django_competition.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Competition',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('description', models.TextField()),
                ('votes_per_day', models.IntegerField(default=-1, help_text='If > 0 allows single e-mail to vote this many votes in each day.If <= 0 allows only single vote.')),
                ('entries_per_vote', models.PositiveIntegerField(default=3, help_text='How many (equally weighted) entries you may select in each vote. ', validators=[django.core.validators.MinValueValidator(1)])),
                ('allow_disposable_emails', models.BooleanField(default=True, help_text='If false we will try to block disposable e-mails.')),
                ('competition_encryption_key', models.BinaryField(default=django_competition.models.random_key, help_text='Encryption key used to sign vote requests.')),
            ],
        ),
        migrations.CreateModel(
            name='CompetitionEntry',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
                ('description', models.TextField()),
                ('votes', models.IntegerField(default=0)),
                ('competition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='entries', to='django_competition.Competition')),
            ],
        ),
        migrations.CreateModel(
            name='Vote',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('entry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='entries', to='django_competition.CompetitionEntry')),
            ],
        ),
        migrations.CreateModel(
            name='VoteGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('vote_source', models.TextField()),
                ('date_voted', models.DateTimeField(auto_now_add=True)),
                ('used_nonce', models.BinaryField(db_index=True)),
                ('competition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_competition.Competition')),
            ],
        ),
        migrations.AddField(
            model_name='vote',
            name='group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='votes', to='django_competition.VoteGroup'),
        ),
    ]
