# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-16 15:29
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='BaseAction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='BaseCondition',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Rule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')),
                ('target_content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='rules', to='contenttypes.ContentType', verbose_name='target content type')),
            ],
            options={
                'ordering': ('-modified', '-created'),
                'abstract': False,
                'get_latest_by': 'modified',
                'verbose_name': 'rule',
                'verbose_name_plural': 'rules',
            },
        ),
        migrations.CreateModel(
            name='BaseCronCondition',
            fields=[
                ('basecondition_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='conditioner.BaseCondition')),
                ('last_executed', models.DateTimeField(editable=False, null=True, verbose_name='last executed')),
            ],
            options={
                'abstract': False,
            },
            bases=('conditioner.basecondition',),
        ),
        migrations.CreateModel(
            name='LoggerAction',
            fields=[
                ('baseaction_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='conditioner.BaseAction')),
                ('level', models.CharField(choices=[('DEBUG', 'Debug'), ('INFO', 'Info'), ('WARNING', 'Warning'), ('ERROR', 'Error'), ('CRITICAL', 'Critical')], max_length=64, verbose_name='logging level')),
                ('message', models.TextField(verbose_name='message')),
            ],
            options={
                'abstract': False,
                'verbose_name': 'logger action',
                'verbose_name_plural': 'logger actions',
            },
            bases=('conditioner.baseaction',),
        ),
        migrations.CreateModel(
            name='ModelSignalCondition',
            fields=[
                ('basecondition_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='conditioner.BaseCondition')),
                ('signal', models.CharField(choices=[('Save', (('pre_save', 'Before creation'), ('post_save', 'After creation'))), ('Delete', (('pre_delete', 'Before deletion'), ('post_delete', 'After deletion'))), ('Init', (('pre_init', 'Before initialization'), ('post_init', 'After initialization')))], max_length=64, verbose_name='signal')),
                ('dispatch_uid', models.UUIDField(default=uuid.uuid4, editable=False, verbose_name='dispatch ID')),
            ],
            options={
                'abstract': False,
                'verbose_name': 'model signal condition',
                'verbose_name_plural': 'model signal conditions',
            },
            bases=('conditioner.basecondition',),
        ),
        migrations.CreateModel(
            name='SendTemplatedEmailAction',
            fields=[
                ('baseaction_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='conditioner.BaseAction')),
                ('email', models.EmailField(max_length=254, verbose_name='email address')),
                ('subject', models.CharField(max_length=256, verbose_name='subject')),
                ('template', models.CharField(max_length=256, verbose_name='template')),
            ],
            options={
                'abstract': False,
                'verbose_name': 'send templated email action',
                'verbose_name_plural': 'send templated email actions',
            },
            bases=('conditioner.baseaction',),
        ),
        migrations.AddField(
            model_name='basecondition',
            name='polymorphic_ctype',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_conditioner.basecondition_set+', to='contenttypes.ContentType'),
        ),
        migrations.AddField(
            model_name='basecondition',
            name='rule',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='condition', to='conditioner.Rule', verbose_name='rule'),
        ),
        migrations.AddField(
            model_name='baseaction',
            name='polymorphic_ctype',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_conditioner.baseaction_set+', to='contenttypes.ContentType'),
        ),
        migrations.AddField(
            model_name='baseaction',
            name='rule',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='action', to='conditioner.Rule', verbose_name='rule'),
        ),
        migrations.CreateModel(
            name='DayOfMonthCondition',
            fields=[
                ('basecroncondition_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='conditioner.BaseCronCondition')),
                ('day', models.PositiveSmallIntegerField(help_text='Action will occur every month on that day.', validators=[django.core.validators.MaxValueValidator(31)], verbose_name='day of the month')),
            ],
            options={
                'abstract': False,
                'verbose_name': 'day of month condition',
                'verbose_name_plural': 'day of month conditions',
            },
            bases=('conditioner.basecroncondition',),
        ),
        migrations.CreateModel(
            name='DayOfWeekCondition',
            fields=[
                ('basecroncondition_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='conditioner.BaseCronCondition')),
                ('weekday', models.PositiveSmallIntegerField(choices=[(1, 'Monday'), (2, 'Tuesday'), (3, 'Wednesday'), (4, 'Thursday'), (5, 'Friday'), (6, 'Sunday'), (7, 'Saturday')], help_text='Action will occur every week on that day.', verbose_name='day of the week')),
            ],
            options={
                'abstract': False,
                'verbose_name': 'day of week condition',
                'verbose_name_plural': 'day of week conditions',
            },
            bases=('conditioner.basecroncondition',),
        ),
    ]
