# Generated by Django 5.2.10 on 2026-02-04 05:11

import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="GateConfigModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "config_id",
                    models.CharField(
                        db_index=True, help_text="配置唯一标识符", max_length=64, unique=True
                    ),
                ),
                (
                    "risk_profile",
                    models.CharField(
                        choices=[
                            ("CONSERVATIVE", "保守型"),
                            ("BALANCED", "平衡型"),
                            ("AGGRESSIVE", "激进型"),
                        ],
                        db_index=True,
                        default="BALANCED",
                        help_text="风险画像",
                        max_length=20,
                    ),
                ),
                ("version", models.IntegerField(default=1, help_text="配置版本号")),
                (
                    "is_active",
                    models.BooleanField(db_index=True, default=True, help_text="是否激活"),
                ),
                ("regime_constraints", models.JSONField(default=dict, help_text="Regime 约束配置")),
                ("policy_constraints", models.JSONField(default=dict, help_text="Policy 约束配置")),
                ("portfolio_constraints", models.JSONField(default=dict, help_text="组合约束配置")),
                ("created_at", models.DateTimeField(auto_now_add=True, help_text="创建时间")),
                ("updated_at", models.DateTimeField(auto_now=True, help_text="更新时间")),
                (
                    "effective_date",
                    models.DateField(default=django.utils.timezone.now, help_text="生效日期"),
                ),
                (
                    "expires_at",
                    models.DateField(blank=True, help_text="过期日期（可选）", null=True),
                ),
            ],
            options={
                "verbose_name": "Beta Gate 配置",
                "verbose_name_plural": "Beta Gate 配置",
                "db_table": "beta_gate_config",
                "ordering": ["-version", "risk_profile"],
                "indexes": [
                    models.Index(
                        fields=["risk_profile", "is_active"], name="beta_gate_c_risk_pr_7645b8_idx"
                    ),
                    models.Index(
                        fields=["effective_date", "expires_at"],
                        name="beta_gate_c_effecti_2b5097_idx",
                    ),
                ],
            },
        ),
        migrations.CreateModel(
            name="GateDecisionModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "decision_id",
                    models.CharField(
                        db_index=True, help_text="决策唯一标识符", max_length=64, unique=True
                    ),
                ),
                (
                    "asset_code",
                    models.CharField(db_index=True, help_text="资产代码", max_length=32),
                ),
                ("asset_class", models.CharField(help_text="资产类别", max_length=64)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("passed", "通过"),
                            ("blocked_regime", "Regime拦截"),
                            ("blocked_policy", "Policy拦截"),
                            ("blocked_risk", "风险拦截"),
                            ("blocked_confidence", "置信度拦截"),
                            ("blocked_portfolio", "组合拦截"),
                            ("watch", "观察"),
                        ],
                        help_text="决策状态",
                        max_length=20,
                    ),
                ),
                (
                    "current_regime",
                    models.CharField(db_index=True, help_text="当前 Regime", max_length=32),
                ),
                ("policy_level", models.IntegerField(help_text="Policy 档位")),
                ("regime_confidence", models.FloatField(help_text="Regime 置信度")),
                (
                    "evaluation_details",
                    models.JSONField(blank=True, default=dict, help_text="评估详情"),
                ),
                (
                    "evaluated_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, help_text="评估时间"),
                ),
            ],
            options={
                "verbose_name": "Beta Gate 决策",
                "verbose_name_plural": "Beta Gate 决策",
                "db_table": "beta_gate_decision",
                "ordering": ["-evaluated_at"],
                "indexes": [
                    models.Index(
                        fields=["asset_code", "-evaluated_at"],
                        name="beta_gate_d_asset_c_de98a2_idx",
                    ),
                    models.Index(
                        fields=["current_regime", "-evaluated_at"],
                        name="beta_gate_d_current_94fbed_idx",
                    ),
                    models.Index(
                        fields=["status", "-evaluated_at"], name="beta_gate_d_status_5365a6_idx"
                    ),
                ],
            },
        ),
        migrations.CreateModel(
            name="VisibilityUniverseSnapshotModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "snapshot_id",
                    models.CharField(
                        db_index=True, help_text="快照唯一标识符", max_length=64, unique=True
                    ),
                ),
                (
                    "regime_snapshot_id",
                    models.CharField(blank=True, help_text="Regime 快照 ID", max_length=64),
                ),
                (
                    "policy_snapshot_id",
                    models.CharField(blank=True, help_text="Policy 快照 ID", max_length=64),
                ),
                (
                    "current_regime",
                    models.CharField(db_index=True, help_text="当前 Regime", max_length=32),
                ),
                ("policy_level", models.IntegerField(help_text="Policy 档位")),
                ("regime_confidence", models.FloatField(help_text="Regime 置信度")),
                (
                    "risk_profile",
                    models.CharField(
                        choices=[
                            ("CONSERVATIVE", "保守型"),
                            ("BALANCED", "平衡型"),
                            ("AGGRESSIVE", "激进型"),
                        ],
                        default="BALANCED",
                        help_text="风险画像",
                        max_length=20,
                    ),
                ),
                (
                    "visible_asset_categories",
                    models.JSONField(default=list, help_text="可见资产类别列表"),
                ),
                ("visible_strategies", models.JSONField(default=list, help_text="可见策略列表")),
                ("hard_exclusions", models.JSONField(default=list, help_text="硬排除列表")),
                ("watch_list", models.JSONField(default=list, help_text="观察列表")),
                (
                    "as_of",
                    models.DateField(default=django.utils.timezone.now, help_text="截止日期"),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, help_text="创建时间"),
                ),
            ],
            options={
                "verbose_name": "可见性宇宙快照",
                "verbose_name_plural": "可见性宇宙快照",
                "db_table": "beta_gate_universe_snapshot",
                "ordering": ["-as_of"],
                "indexes": [
                    models.Index(
                        fields=["current_regime", "policy_level", "-as_of"],
                        name="beta_gate_u_current_3dcc36_idx",
                    )
                ],
            },
        ),
    ]
