# Generated by Django 5.0.2 on 2025-07-23 20:36

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


class Migration(migrations.Migration):

    dependencies = [
        ('settings', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='EmailLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('recipient_email', models.EmailField(max_length=254)),
                ('recipient_name', models.CharField(blank=True, max_length=200)),
                ('subject', models.CharField(max_length=500)),
                ('email_type', models.CharField(choices=[('invitation', 'Account Invitation'), ('password_reset', 'Password Reset'), ('test_email', 'Test Email'), ('invoice', 'Invoice Notification'), ('system', 'System Notification'), ('other', 'Other')], default='other', max_length=20)),
                ('status', models.CharField(choices=[('sent', 'Sent Successfully'), ('failed', 'Failed to Send'), ('pending', 'Pending')], default='pending', max_length=10)),
                ('sent_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('error_message', models.TextField(blank=True, null=True)),
                ('customer_id', models.PositiveIntegerField(blank=True, help_text='Customer ID if email is customer-related', null=True)),
                ('employee_id', models.PositiveIntegerField(blank=True, help_text='Employee ID if email is employee-related', null=True)),
                ('sent_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Email Log',
                'verbose_name_plural': 'Email Logs',
                'ordering': ['-sent_at'],
            },
        ),
    ]
