# Generated by Django 4.2.20 on 2025-04-18 21:12

from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='EmailLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.CharField(blank=True, max_length=255, null=True)),
                ('updated_by', models.CharField(blank=True, max_length=255, null=True)),
                ('recipient_to', models.TextField(help_text='Comma-separated list of main recipients.', verbose_name='Recipient To')),
                ('recipient_cc', models.TextField(blank=True, help_text='Comma-separated list of CC recipients.', verbose_name='Recipient CC')),
                ('recipient_bcc', models.TextField(blank=True, help_text='Comma-separated list of BCC recipients.', verbose_name='Recipient BCC')),
                ('sender', models.EmailField(max_length=254, verbose_name='Sender Email')),
                ('subject', models.CharField(max_length=255, verbose_name='Subject')),
                ('body_text', models.TextField(blank=True, help_text='Plain text version of the email body.', verbose_name='Body (Text)')),
                ('body_html', models.TextField(blank=True, help_text='HTML version of the email body.', verbose_name='Body (HTML)')),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('SCHEDULED', 'Scheduled'), ('SENT', 'Sent'), ('FAILED', 'Failed')], db_index=True, default='PENDING', max_length=10, verbose_name='Status')),
                ('provider_status', models.CharField(blank=True, help_text='Status code or message from the email provider (e.g., SendGrid, SMTP).', max_length=100, null=True, verbose_name='Provider Status')),
                ('provider_message', models.TextField(blank=True, help_text='Detailed message or error returned by the email provider.', null=True, verbose_name='Provider Message')),
                ('retry_count', models.PositiveIntegerField(default=0, verbose_name='Retry Count')),
                ('last_attempt_time', models.DateTimeField(blank=True, null=True, verbose_name='Last Attempt Time')),
                ('scheduled_time', models.DateTimeField(blank=True, help_text='When this email is scheduled to be sent. If set, status should be SCHEDULED.', null=True, verbose_name='Scheduled Time')),
            ],
            options={
                'verbose_name': 'Email Log',
                'verbose_name_plural': 'Email Logs',
                'ordering': ['-created_at'],
            },
        ),
    ]
