# Generated by Django 5.2.12 on 2026-04-26 23:34

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("regime", "0006_action_recommendation_contract"),
    ]

    operations = [
        migrations.SeparateDatabaseAndState(
            database_operations=[],
            state_operations=[
        migrations.CreateModel(
            name="RiskParameterConfigModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "key",
                    models.CharField(
                        help_text="如 position_p1, adjustment_recovery 等",
                        max_length=100,
                        unique=True,
                        verbose_name="参数键",
                    ),
                ),
                ("name", models.CharField(max_length=100, verbose_name="参数名称")),
                (
                    "parameter_type",
                    models.CharField(
                        choices=[
                            ("position_size", "仓位大小"),
                            ("adjustment_factor", "调整因子"),
                            ("stop_loss", "止损参数"),
                            ("volatility", "波动率参数"),
                            ("other", "其他"),
                        ],
                        max_length=20,
                        verbose_name="参数类型",
                    ),
                ),
                ("value_float", models.FloatField(blank=True, null=True, verbose_name="数值")),
                (
                    "value_string",
                    models.CharField(blank=True, max_length=200, verbose_name="字符串值"),
                ),
                ("value_json", models.JSONField(blank=True, null=True, verbose_name="JSON 值")),
                (
                    "policy_level",
                    models.CharField(
                        blank=True,
                        help_text="如 P0, P1, P2, P3，留空表示全部适用",
                        max_length=10,
                        verbose_name="适用政策档位",
                    ),
                ),
                (
                    "regime",
                    models.CharField(
                        blank=True,
                        help_text="留空表示全部适用",
                        max_length=20,
                        verbose_name="适用 Regime",
                    ),
                ),
                (
                    "asset_class",
                    models.CharField(
                        blank=True,
                        help_text="留空表示全部适用",
                        max_length=50,
                        verbose_name="适用资产类别",
                    ),
                ),
                ("is_active", models.BooleanField(default=True, verbose_name="是否启用")),
                ("description", models.TextField(blank=True, verbose_name="描述")),
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("updated_at", models.DateTimeField(auto_now=True, verbose_name="更新时间")),
            ],
            options={
                "verbose_name": "风险参数配置",
                "verbose_name_plural": "风险参数配置",
                "db_table": "risk_parameter_config",
            },
        ),
        migrations.CreateModel(
            name="RegimeEligibilityConfigModel",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("asset_class", models.CharField(max_length=50, verbose_name="资产类别")),
                (
                    "regime",
                    models.CharField(
                        help_text="Recovery/Overheat/Stagflation/Deflation",
                        max_length=20,
                        verbose_name="Regime",
                    ),
                ),
                (
                    "eligibility",
                    models.CharField(
                        choices=[("preferred", "优选"), ("neutral", "中性"), ("hostile", "敌对")],
                        max_length=20,
                        verbose_name="准入状态",
                    ),
                ),
                (
                    "weight",
                    models.FloatField(
                        default=1.0, help_text="该资产在该 Regime 下的权重", verbose_name="权重"
                    ),
                ),
                (
                    "adjustment_factor",
                    models.FloatField(
                        default=1.0, help_text="额外的权重调整系数", verbose_name="调整因子"
                    ),
                ),
                ("is_active", models.BooleanField(default=True, verbose_name="是否启用")),
                ("notes", models.TextField(blank=True, verbose_name="备注")),
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("updated_at", models.DateTimeField(auto_now=True, verbose_name="更新时间")),
            ],
            options={
                "verbose_name": "Regime 准入矩阵配置",
                "verbose_name_plural": "Regime 准入矩阵配置",
                "db_table": "regime_eligibility_config",
                "indexes": [
                    models.Index(
                        fields=["asset_class", "regime"], name="regime_elig_asset_c_96db03_idx"
                    ),
                    models.Index(fields=["is_active"], name="regime_elig_is_acti_551a9f_idx"),
                ],
                "unique_together": {("asset_class", "regime")},
            },
        ),
            ],
        ),
    ]
