from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="FarmAlertNotification",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("farm_uuid", models.UUIDField(db_index=True)),
                ("endpoint", models.CharField(choices=[("tracker", "Tracker"), ("timeline", "Timeline")], db_index=True, max_length=32)),
                ("level", models.CharField(choices=[("info", "اطلاع رسانی"), ("warning", "هشدار"), ("danger", "خطر")], db_index=True, max_length=16)),
                ("title", models.CharField(max_length=255)),
                ("message", models.TextField(blank=True)),
                ("suggested_action", models.TextField(blank=True)),
                ("source_alert_id", models.CharField(blank=True, db_index=True, max_length=255)),
                ("source_metric_type", models.CharField(blank=True, db_index=True, max_length=64)),
                ("fingerprint", models.CharField(max_length=64, unique=True)),
                ("payload", models.JSONField(blank=True, default=dict)),
                ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "db_table": "farm_alerts_notification",
                "ordering": ["-updated_at", "-created_at"],
                "verbose_name": "Farm Alert Notification",
                "verbose_name_plural": "Farm Alert Notifications",
                "indexes": [
                    models.Index(fields=["farm_uuid", "endpoint", "-updated_at"], name="farm_alerts_farm_ep_updated_idx"),
                    models.Index(fields=["farm_uuid", "level", "-updated_at"], name="farm_alerts_farm_level_updated_idx"),
                ],
            },
        ),
    ]
