# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-09 14:19
from __future__ import unicode_literals

from decimal import Decimal
from django.conf import settings
from django.db import migrations, models
import django.utils.timezone

from django_webix_sender.settings import CONF


class Migration(migrations.Migration):

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

    operations = []

    if any(_recipients['model'] == 'django_webix_sender.Customer' for _recipients in CONF['recipients']):
        operations.append(migrations.AddField(
            model_name='customer',
            name='creation_date',
            field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Creation date'),
            preserve_default=False,
        ))
        operations.append(migrations.AddField(
            model_name='customer',
            name='modification_date',
            field=models.DateTimeField(auto_now=True, verbose_name='Modification data'),
        ))
        operations.append(migrations.AddField(
            model_name='customertypology',
            name='creation_date',
            field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Creation date'),
            preserve_default=False,
        ))
        operations.append(migrations.AddField(
            model_name='customertypology',
            name='modification_date',
            field=models.DateTimeField(auto_now=True, verbose_name='Modification data'),
        ))

    if any(_recipients['model'] == 'django_webix_sender.ExternalSubject' for _recipients in CONF['recipients']):
        operations.append(migrations.AddField(
            model_name='externalsubject',
            name='creation_date',
            field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Creation date'),
            preserve_default=False,
        ))
        operations.append(migrations.AddField(
            model_name='externalsubject',
            name='modification_date',
            field=models.DateTimeField(auto_now=True, verbose_name='Modification data'),
        ))
        operations.append(migrations.AddField(
            model_name='externalsubjecttypology',
            name='creation_date',
            field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Creation date'),
            preserve_default=False,
        ))
        operations.append(migrations.AddField(
            model_name='externalsubjecttypology',
            name='modification_date',
            field=models.DateTimeField(auto_now=True, verbose_name='Modification data'),
        ))

    if CONF['attachments']['model'] == 'django_webix_sender.MessageAttachment':
        operations.append(migrations.AddField(
            model_name='messageattachment',
            name='creation_date',
            field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Creation date'),
            preserve_default=False,
        ))
        operations.append(migrations.AddField(
            model_name='messageattachment',
            name='modification_date',
            field=models.DateTimeField(auto_now=True, verbose_name='Modification data'),
        ))

    operations.append(migrations.AddField(
        model_name='messagerecipient',
        name='creation_date',
        field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Creation date'),
        preserve_default=False,
    ))
    operations.append(migrations.AddField(
        model_name='messagerecipient',
        name='extra',
        field=models.TextField(blank=True, null=True, verbose_name='Extra'),
    ))
    operations.append(migrations.AddField(
        model_name='messagerecipient',
        name='modification_date',
        field=models.DateTimeField(auto_now=True, verbose_name='Modification data'),
    ))
    operations.append(migrations.AddField(
        model_name='messagerecipient',
        name='sent_number',
        field=models.IntegerField(default=1, verbose_name='Sent number'),
    ))
    operations.append(migrations.AddField(
        model_name='messagerecipient',
        name='status',
        field=models.CharField(choices=[
            ('success', 'Success'),
            ('failed', 'Failed'),
            ('unknown', 'Unknown'),
            ('invalid', 'Invalid'),
            ('duplicate', 'Duplicate')
        ], default='unknown', max_length=32),
    ))
    operations.append(migrations.AddField(
        model_name='messagerecipient',
        name='recipient_address',
        field=models.CharField(default='empty', max_length=255, verbose_name='Recipient address'),
        preserve_default=False,
    ))

    operations.append(migrations.AddField(
        model_name='messagesent',
        name='cost',
        field=models.DecimalField(decimal_places=4, default=Decimal('0.0000'), max_digits=6, verbose_name='Cost'),
    ))
    operations.append(migrations.AddField(
        model_name='messagesent',
        name='creation_date',
        field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Creation date'),
        preserve_default=False,
    ))
    operations.append(migrations.AddField(
        model_name='messagesent',
        name='invoiced',
        field=models.BooleanField(default=False, verbose_name='Invoiced'),
    ))
    operations.append(migrations.AddField(
        model_name='messagesent',
        name='modification_date',
        field=models.DateTimeField(auto_now=True, verbose_name='Modification data'),
    ))
    operations.append(migrations.AddField(
        model_name='messagesent',
        name='sender',
        field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Sender'),
    ))
    operations.append(migrations.AddField(
        model_name='messagesent',
        name='user',
        field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
                                to=settings.AUTH_USER_MODEL, verbose_name='User'),
    ))

    if CONF['typology_model']['enabled']:
        operations.append(migrations.AddField(
            model_name='messagetypology',
            name='creation_date',
            field=models.DateTimeField(auto_now_add=True, default=None, verbose_name='Creation date'),
            preserve_default=False,
        ))
        operations.append(migrations.AddField(
            model_name='messagetypology',
            name='modification_date',
            field=models.DateTimeField(auto_now=True, verbose_name='Modification data'),
        ))
