# Generated by Django 3.2.5 on 2021-07-15 16:08

from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields


class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('msgs', '0006_tpl_fields_changed'),
    ]

    operations = [
        migrations.CreateModel(
            name='EmailTemplate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='default name', max_length=64)),
                ('notes', models.CharField(blank=True, max_length=128, null=True)),
                ('key', models.CharField(max_length=32, unique=True)),
                ('subject_en', models.CharField(default='Subject', max_length=254)),
                ('body_en', models.TextField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
                ('recipient', models.CharField(max_length=64)),
                ('context', models.JSONField(blank=True, null=True)),
                ('status', models.CharField(choices=[('in_queue', 'In queue'), ('sent', 'Sent'), ('error', 'Error'), ('delivered', 'Delivered'), ('rejected', 'Rejected')], default='in_queue', max_length=16)),
                ('error', models.CharField(blank=True, max_length=256, null=True)),
                ('provider_id', models.CharField(blank=True, max_length=64, null=True)),
                ('provider_response', models.CharField(blank=True, max_length=256, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True)),
                ('modified_at', models.DateTimeField(auto_now=True, null=True)),
                ('object_id', models.PositiveIntegerField(blank=True, null=True)),
                ('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='MessageTemplate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='default name', max_length=64)),
                ('notes', models.CharField(blank=True, max_length=128, null=True)),
                ('key', models.CharField(max_length=32, unique=True)),
                ('subject_en', models.CharField(default='Subject', max_length=254)),
                ('body_en', models.TextField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SMSTemplate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='default name', max_length=64)),
                ('notes', models.CharField(blank=True, max_length=128, null=True)),
                ('key', models.CharField(max_length=32, unique=True)),
                ('subject_en', models.CharField(default='Subject', max_length=254)),
                ('body_en', models.TextField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.RemoveField(
            model_name='msg',
            name='tpl',
        ),
        migrations.DeleteModel(
            name='Email',
        ),
        migrations.DeleteModel(
            name='SMS',
        ),
        migrations.CreateModel(
            name='Email',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
                ('recipient', models.CharField(max_length=64)),
                ('context', models.JSONField(blank=True, null=True)),
                ('status', models.CharField(choices=[('in_queue', 'In queue'), ('sent', 'Sent'), ('error', 'Error'), ('delivered', 'Delivered'), ('rejected', 'Rejected')], default='in_queue', max_length=16)),
                ('error', models.CharField(blank=True, max_length=256, null=True)),
                ('provider_id', models.CharField(blank=True, max_length=64, null=True)),
                ('provider_response', models.CharField(blank=True, max_length=256, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True)),
                ('modified_at', models.DateTimeField(auto_now=True, null=True)),
                ('object_id', models.PositiveIntegerField(blank=True, null=True)),
                ('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
                ('template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='msgs.emailtemplate')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SMS',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
                ('recipient', models.CharField(max_length=64)),
                ('context', models.JSONField(blank=True, null=True)),
                ('status', models.CharField(choices=[('in_queue', 'In queue'), ('sent', 'Sent'), ('error', 'Error'), ('delivered', 'Delivered'), ('rejected', 'Rejected')], default='in_queue', max_length=16)),
                ('error', models.CharField(blank=True, max_length=256, null=True)),
                ('provider_id', models.CharField(blank=True, max_length=64, null=True)),
                ('provider_response', models.CharField(blank=True, max_length=256, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True)),
                ('modified_at', models.DateTimeField(auto_now=True, null=True)),
                ('object_id', models.PositiveIntegerField(blank=True, null=True)),
                ('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
                ('template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='msgs.smstemplate')),
            ],
            options={
                'verbose_name_plural': 'SMS',
            },
        ),
        migrations.DeleteModel(
            name='Msg',
        ),
        migrations.DeleteModel(
            name='Tpl',
        ),
        migrations.AddField(
            model_name='message',
            name='template',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='msgs.messagetemplate'),
        ),
    ]
