# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-31 13:24
from __future__ import unicode_literals

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import re


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='EmailNotification',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('from_email', models.EmailField(blank=True, max_length=254)),
                ('recipient_email', models.EmailField(blank=True, max_length=254)),
                ('subject', models.CharField(blank=True, max_length=255)),
                ('body_txt', models.TextField(blank=True)),
                ('body_html', models.TextField(blank=True, null=True)),
                ('is_sent', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='NotificationMeta',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('s_pks', models.CharField(max_length=4096, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:\\,\\d+)*\\Z'), code='invalid', message='Enter only digits separated by commas.')], verbose_name=b'Subject Pks')),
                ('o_pks', models.CharField(max_length=4096, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:\\,\\d+)*\\Z'), code='invalid', message='Enter only digits separated by commas.')], verbose_name=b'Object Pks')),
                ('url', models.CharField(max_length=255)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('published_at', models.DateTimeField(auto_now_add=True)),
                ('read_at', models.DateTimeField(blank=True, null=True)),
                ('is_published', models.BooleanField(default=False)),
                ('is_read', models.BooleanField(default=False)),
            ],
            options={
                'ordering': ['-updated_at'],
                'verbose_name_plural': 'notification metas',
            },
        ),
        migrations.CreateModel(
            name='NotificationPreference',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('preferences', jsonfield.fields.JSONField(default={})),
            ],
        ),
        migrations.CreateModel(
            name='NotificationType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(help_text=b'Used for generating template names for this notification type.', max_length=255)),
                ('default_preferences', jsonfield.fields.JSONField(default={}, help_text=b'Default preferences that will be used if user has no NotificationPreference or NotificationPreference has no info about that kind of notification.')),
                ('plural', models.CharField(blank=True, choices=[(b'sub', b'Subject'), (b'obj', b'Object'), (b'both', b'Both')], max_length=32, null=True)),
                ('collecting_period', models.PositiveSmallIntegerField(default=10, help_text=b'Amount of minutes that kind notifications collected and grouped.')),
                ('is_active', models.BooleanField(default=False, help_text=b'You can stop that kind of of notifications by unchecking this.')),
                ('o_ct', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='o_ct', to='contenttypes.ContentType', verbose_name=b'Object Type')),
                ('s_ct', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='s_ct', to='contenttypes.ContentType', verbose_name=b'Subject Type')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='NotificationTypeTranslation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('language_code', models.CharField(choices=[(b'en', 'English'), (b'tr', 'Turkish')], max_length=7, verbose_name='language')),
                ('name', models.CharField(max_length=255)),
                ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='notification.NotificationType')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SiteNotification',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('meta', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='notification.NotificationMeta')),
            ],
        ),
        migrations.AddField(
            model_name='notificationpreference',
            name='ntype',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='notification.NotificationType'),
        ),
        migrations.AddField(
            model_name='notificationpreference',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='notificationmeta',
            name='ntype',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='notification.NotificationType', verbose_name=b'Type'),
        ),
        migrations.AddField(
            model_name='notificationmeta',
            name='recipient',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='recipient', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='emailnotification',
            name='meta',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='notification.NotificationMeta'),
        ),
    ]
