# Generated by Django 5.2.4 on 2025-09-19 19:59

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


class Migration(migrations.Migration):

    dependencies = [
        ("core", "0034_alter_package_license"),
        ("django_celery_beat", "0019_alter_periodictasks_options"),
    ]

    operations = [
        migrations.AddField(
            model_name="clientreport",
            name="disable_emails",
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name="clientreport",
            name="owner",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="client_reports",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="clientreport",
            name="recipients",
            field=models.JSONField(blank=True, default=list),
        ),
        migrations.CreateModel(
            name="ClientReportSchedule",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "periodicity",
                    models.CharField(
                        choices=[
                            ("none", "One-time"),
                            ("daily", "Daily"),
                            ("weekly", "Weekly"),
                            ("monthly", "Monthly"),
                        ],
                        default="none",
                        max_length=12,
                    ),
                ),
                ("email_recipients", models.JSONField(blank=True, default=list)),
                ("disable_emails", models.BooleanField(default=False)),
                ("last_generated_on", models.DateTimeField(blank=True, null=True)),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="created_client_report_schedules",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "owner",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="client_report_schedules",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "periodic_task",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="client_report_schedule",
                        to="django_celery_beat.periodictask",
                    ),
                ),
            ],
            options={
                "verbose_name": "Client Report Schedule",
                "verbose_name_plural": "Client Report Schedules",
            },
        ),
        migrations.AddField(
            model_name="clientreport",
            name="schedule",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="reports",
                to="core.clientreportschedule",
            ),
        ),
    ]
