# Generated by Django 5.2.8 on 2025-11-23 00:16

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


class Migration(migrations.Migration):

    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
        ("pages", "0040_add_ocpp_net_monitor_landing"),
    ]

    operations = [
        migrations.CreateModel(
            name="DashboardRule",
            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)),
                ("name", models.CharField(max_length=200, unique=True)),
                (
                    "implementation",
                    models.CharField(
                        choices=[
                            ("condition", "SQL + Sigil comparison"),
                            ("python", "Python callable"),
                        ],
                        default="python",
                        max_length=20,
                    ),
                ),
                ("condition", core.fields.ConditionTextField(blank=True, default="")),
                ("function_name", models.CharField(blank=True, max_length=255)),
                (
                    "success_message",
                    models.CharField(default="All rules met.", max_length=200),
                ),
                ("failure_message", models.CharField(blank=True, max_length=500)),
                (
                    "content_type",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="dashboard_rule",
                        to="contenttypes.contenttype",
                    ),
                ),
            ],
            options={
                "verbose_name": "Dashboard Rule",
                "verbose_name_plural": "Dashboard Rules",
                "ordering": ["name"],
            },
        ),
    ]
