# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-07 00:27
from __future__ import unicode_literals

import aoml.models
import datetime
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Attachment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=255, verbose_name='title')),
                ('file_attachment', models.FileField(max_length=255, upload_to=aoml.models.get_newsletter_storage_path, verbose_name='file to attach')),
            ],
            options={
                'verbose_name': 'attachment',
                'verbose_name_plural': 'attachments',
            },
        ),
        migrations.CreateModel(
            name='Contact',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email', models.EmailField(max_length=254, unique=True, verbose_name='email')),
                ('tester', models.BooleanField(default=False, verbose_name='contact tester')),
                ('object_id', models.PositiveIntegerField(blank=True, null=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='creation date')),
                ('modification_date', models.DateTimeField(auto_now=True, verbose_name='modification date')),
                ('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
            options={
                'verbose_name': 'contact',
                'verbose_name_plural': 'contacts',
                'ordering': ('creation_date',),
            },
        ),
        migrations.CreateModel(
            name='ContactMailingStatus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.IntegerField(choices=[(-1, 'sent in test'), (0, 'sent'), (1, 'error'), (2, 'invalid email'), (4, 'opened'), (5, 'opened on site'), (6, 'link opened'), (7, 'unsubscription')], verbose_name='status')),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='creation date')),
                ('contact', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aoml.Contact', verbose_name='contact')),
            ],
            options={
                'verbose_name': 'contact mailing status',
                'verbose_name_plural': 'contact mailing statuses',
                'ordering': ('-creation_date',),
            },
        ),
        migrations.CreateModel(
            name='Link',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=2000, verbose_name='title')),
                ('url', models.CharField(max_length=2000, verbose_name='url')),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='creation date')),
            ],
            options={
                'verbose_name': 'link',
                'verbose_name_plural': 'links',
                'ordering': ('-creation_date',),
            },
        ),
        migrations.CreateModel(
            name='MailingList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='name')),
                ('description', models.TextField(blank=True, verbose_name='description')),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='creation date')),
                ('modification_date', models.DateTimeField(auto_now=True, verbose_name='modification date')),
                ('subscribers', models.ManyToManyField(blank=True, related_name='mailinglist_subscriber', to='aoml.Contact', verbose_name='subscribers')),
            ],
            options={
                'verbose_name': 'mailing list',
                'verbose_name_plural': 'mailing lists',
                'ordering': ('-creation_date',),
            },
        ),
        migrations.CreateModel(
            name='Newsletter',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(help_text='You can use the "{{ UNIQUE_KEY }}" variable for unique identifier within the newsletter\'s title.', max_length=255, verbose_name='title')),
                ('import_url', models.CharField(blank=True, default='', help_text='Specify an URL to import HTML from', max_length=255, verbose_name='import_url')),
                ('content', models.TextField(default='<body>\n<!-- Edit your newsletter here -->\n</body>', help_text='Newletter content', verbose_name='content')),
                ('header_sender', models.CharField(default='DJ Anael<contact@djanael.com>', max_length=255, verbose_name='sender')),
                ('header_reply', models.CharField(default='DJ Anael<contact@djanael.com>', max_length=255, verbose_name='reply to')),
                ('status', models.IntegerField(choices=[(0, 'draft'), (1, 'waiting sending'), (2, 'sending'), (4, 'sent'), (5, 'canceled')], default=0, verbose_name='status')),
                ('sending_date', models.DateTimeField(default=datetime.datetime.now, verbose_name='sending date')),
                ('slug', models.SlugField(help_text='Used for displaying the newsletter on the site.', unique=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='creation date')),
                ('modification_date', models.DateTimeField(auto_now=True, verbose_name='modification date')),
                ('mailing_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aoml.MailingList', verbose_name='mailing list')),
            ],
            options={
                'verbose_name': 'newsletter',
                'verbose_name_plural': 'newsletters',
                'ordering': ('-creation_date',),
                'permissions': (('can_change_status', 'Can change status'),),
            },
        ),
        migrations.CreateModel(
            name='SMTPServer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='name')),
                ('host', models.CharField(max_length=255, verbose_name='server host')),
                ('user', models.CharField(blank=True, help_text='Leave it empty if the host is public.', max_length=128, verbose_name='server user')),
                ('password', models.CharField(blank=True, help_text='Leave it empty if the host is public.', max_length=128, verbose_name='server password')),
                ('port', models.IntegerField(default=25, verbose_name='server port')),
                ('tls', models.BooleanField(verbose_name='server use TLS')),
                ('ssl', models.BooleanField(default=True, verbose_name='server use SSL')),
                ('headers', models.TextField(blank=True, help_text='key1: value1 key2: value2, splitted by return line.\nUseful for passing some tracking headers if your provider allows it.', verbose_name='custom headers')),
                ('mails_hour', models.IntegerField(default=0, verbose_name='mails per hour')),
            ],
            options={
                'verbose_name': 'SMTP server',
                'verbose_name_plural': 'SMTP servers',
            },
        ),
        migrations.AddField(
            model_name='newsletter',
            name='server',
            field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='aoml.SMTPServer', verbose_name='smtp server'),
        ),
        migrations.AddField(
            model_name='newsletter',
            name='test_contacts',
            field=models.ManyToManyField(blank=True, to='aoml.Contact', verbose_name='test contacts'),
        ),
        migrations.AddField(
            model_name='contactmailingstatus',
            name='link',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='aoml.Link', verbose_name='link'),
        ),
        migrations.AddField(
            model_name='contactmailingstatus',
            name='newsletter',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aoml.Newsletter', verbose_name='newsletter'),
        ),
        migrations.AddField(
            model_name='attachment',
            name='newsletter',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aoml.Newsletter', verbose_name='newsletter'),
        ),
    ]
