# Generated by Django 4.2.30 on 2026-09-16 06:33

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ScheduledReportRecipient',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email', models.EmailField(max_length=254)),
                ('name', models.CharField(blank=True, max_length=150)),
                ('frequency', models.CharField(choices=[('DAILY', 'Daily'), ('WEEKLY', 'Weekly'), ('MONTHLY', 'Monthly')], default='DAILY', max_length=10)),
                ('send_hour', models.PositiveSmallIntegerField(default=7, help_text='Hour of day (0-23, server local time) to send at.')),
                ('weekly_weekday', models.PositiveSmallIntegerField(default=0, help_text='0=Monday .. 6=Sunday. Only used when frequency is WEEKLY.')),
                ('max_emails_per_day', models.PositiveSmallIntegerField(default=1)),
                ('enabled', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'ordering': ['email'],
                'unique_together': {('email', 'frequency')},
            },
        ),
        migrations.CreateModel(
            name='ScheduledReportLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sent_at', models.DateTimeField(auto_now_add=True)),
                ('success', models.BooleanField(default=True)),
                ('detail', models.CharField(blank=True, max_length=255)),
                ('recipient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='logs', to='email_reports.scheduledreportrecipient')),
            ],
            options={
                'ordering': ['-sent_at'],
            },
        ),
    ]
