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

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("macro", "0014_delete_datasourceconfig_dataprovidersettings"),
    ]

    operations = [
        migrations.SeparateDatabaseAndState(
            database_operations=[],
            state_operations=[
        migrations.CreateModel(
            name="IndicatorConfigModel",
            fields=[
                (
                    "code",
                    models.CharField(
                        max_length=50,
                        primary_key=True,
                        serialize=False,
                        unique=True,
                        verbose_name="指标代码",
                    ),
                ),
                ("name", models.CharField(max_length=100, verbose_name="指标名称")),
                ("name_en", models.CharField(blank=True, max_length=100, verbose_name="英文名称")),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("growth", "增长指标"),
                            ("inflation", "通胀指标"),
                            ("monetary", "货币指标"),
                            ("interest", "利率指标"),
                            ("other", "其他"),
                        ],
                        max_length=20,
                        verbose_name="指标分类",
                    ),
                ),
                ("unit", models.CharField(max_length=10, verbose_name="单位")),
                (
                    "threshold_bullish",
                    models.FloatField(blank=True, null=True, verbose_name="看涨阈值"),
                ),
                (
                    "threshold_bearish",
                    models.FloatField(blank=True, null=True, verbose_name="看跌阈值"),
                ),
                (
                    "data_source",
                    models.CharField(default="akshare", max_length=20, verbose_name="数据源"),
                ),
                (
                    "fetch_frequency",
                    models.CharField(
                        default="M",
                        help_text="D=日, W=周, M=月, Q=季, Y=年",
                        max_length=10,
                        verbose_name="采集频率",
                    ),
                ),
                (
                    "publication_lag_days",
                    models.IntegerField(default=0, verbose_name="发布延迟天数"),
                ),
                ("description", models.TextField(blank=True, verbose_name="描述")),
                ("is_active", models.BooleanField(default=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": "indicator_config",
            },
        ),
            ],
        ),
    ]
