# Generated by Django 5.2.10 on 2026-02-22 14:11

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("alpha", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="AlphaAlertModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "alert_type",
                    models.CharField(
                        choices=[
                            ("inference_failure", "推理失败"),
                            ("data_stale", "数据过期"),
                            ("model_degraded", "模型降级"),
                            ("provider_unavailable", "提供者不可用"),
                        ],
                        db_index=True,
                        help_text="告警类型",
                        max_length=50,
                    ),
                ),
                (
                    "severity",
                    models.CharField(
                        choices=[
                            ("info", "信息"),
                            ("warning", "警告"),
                            ("error", "错误"),
                            ("critical", "严重"),
                        ],
                        db_index=True,
                        default="warning",
                        help_text="严重程度",
                        max_length=20,
                    ),
                ),
                ("title", models.CharField(help_text="告警标题", max_length=255)),
                ("message", models.TextField(help_text="告警详情")),
                ("metadata", models.JSONField(blank=True, help_text="元数据", null=True)),
                (
                    "is_resolved",
                    models.BooleanField(db_index=True, default=False, help_text="是否已解决"),
                ),
                ("resolved_at", models.DateTimeField(blank=True, help_text="解决时间", null=True)),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, help_text="创建时间"),
                ),
            ],
            options={
                "verbose_name": "Alpha 告警",
                "verbose_name_plural": "Alpha 告警",
                "db_table": "alpha_alert",
                "ordering": ["-created_at"],
                "indexes": [
                    models.Index(
                        fields=["alert_type", "is_resolved"], name="alpha_alert_alert_t_74a108_idx"
                    ),
                    models.Index(
                        fields=["severity", "is_resolved"], name="alpha_alert_severit_b87ea4_idx"
                    ),
                ],
            },
        ),
    ]
