# Generated by Django 4.2.22 on 2025-07-17 21:43

import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0050_schedule_coresettings_report_history_prune_days_and_more'),
        ('reporting', '0003_alter_reporthtmltemplate_name_and_more'),
    ]

    operations = [
        migrations.AddField(
            model_name='reportdataquery',
            name='created_by',
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name='reportdataquery',
            name='created_time',
            field=models.DateTimeField(auto_now_add=True, null=True),
        ),
        migrations.AddField(
            model_name='reportdataquery',
            name='modified_by',
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name='reportdataquery',
            name='modified_time',
            field=models.DateTimeField(auto_now=True, null=True),
        ),
        migrations.AddField(
            model_name='reporthtmltemplate',
            name='created_by',
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name='reporthtmltemplate',
            name='created_time',
            field=models.DateTimeField(auto_now_add=True, null=True),
        ),
        migrations.AddField(
            model_name='reporthtmltemplate',
            name='modified_by',
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name='reporthtmltemplate',
            name='modified_time',
            field=models.DateTimeField(auto_now=True, null=True),
        ),
        migrations.AddField(
            model_name='reporttemplate',
            name='created_by',
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name='reporttemplate',
            name='created_time',
            field=models.DateTimeField(auto_now_add=True, null=True),
        ),
        migrations.AddField(
            model_name='reporttemplate',
            name='modified_by',
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name='reporttemplate',
            name='modified_time',
            field=models.DateTimeField(auto_now=True, null=True),
        ),
        migrations.CreateModel(
            name='ReportSchedule',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_by', models.CharField(blank=True, max_length=255, null=True)),
                ('created_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modified_by', models.CharField(blank=True, max_length=255, null=True)),
                ('modified_time', models.DateTimeField(auto_now=True, null=True)),
                ('name', models.CharField(max_length=255)),
                ('enabled', models.BooleanField(default=True)),
                ('format', models.CharField(choices=[('pdf', 'Pdf'), ('html', 'Html'), ('plaintext', 'Plain Text')], default='html', max_length=10)),
                ('dependencies', models.JSONField(default=dict)),
                ('email_recipients', django.contrib.postgres.fields.ArrayField(base_field=models.EmailField(max_length=254), blank=True, default=list, size=None)),
                ('send_report_email', models.BooleanField(default=True)),
                ('last_run', models.DateTimeField(blank=True, null=True)),
                ('locked_at', models.DateTimeField(blank=True, null=True)),
                ('email_settings', models.JSONField(default=dict)),
                ('timezone', models.CharField(blank=True, max_length=100, null=True)),
                ('report_template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reporttemplate_schedules', to='reporting.reporttemplate')),
                ('schedule', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='schedule', to='core.schedule')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ReportHistory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_by', models.CharField(blank=True, max_length=255, null=True)),
                ('created_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modified_by', models.CharField(blank=True, max_length=255, null=True)),
                ('modified_time', models.DateTimeField(auto_now=True, null=True)),
                ('run_by', models.CharField(default='system', max_length=255)),
                ('report_data', models.TextField()),
                ('error_data', models.TextField(blank=True, null=True)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('report_template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reporttemplate_history', to='reporting.reporttemplate')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
