# Generated by Django 5.2.12 on 2026-05-19 02:01

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("data_center", "0028_seed_macro_direct_input_policies"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="MarketThermometerConfigModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("short_window", models.PositiveIntegerField(default=5)),
                ("medium_window", models.PositiveIntegerField(default=20)),
                ("long_window", models.PositiveIntegerField(default=252)),
                ("monthly_long_window", models.PositiveIntegerField(default=24)),
                ("daily_stale_days", models.PositiveIntegerField(default=3)),
                ("monthly_stale_days", models.PositiveIntegerField(default=45)),
                ("min_valid_components", models.PositiveIntegerField(default=4)),
                (
                    "component_weights",
                    models.JSONField(
                        blank=True,
                        default=dict,
                        help_text="Component weights keyed by component_key",
                    ),
                ),
                ("warm_threshold", models.FloatField(default=35.0)),
                ("hot_threshold", models.FloatField(default=60.0)),
                ("overheat_threshold", models.FloatField(default=75.0)),
                ("extreme_threshold", models.FloatField(default=85.0)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "verbose_name": "Market Thermometer Config",
                "verbose_name_plural": "Market Thermometer Config",
                "db_table": "data_center_market_thermometer_config",
            },
        ),
        migrations.CreateModel(
            name="MarketThermometerSnapshotModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("observed_at", models.DateField(db_index=True, unique=True)),
                ("score", models.FloatField()),
                ("band", models.CharField(db_index=True, max_length=20)),
                ("change_5d", models.FloatField(blank=True, null=True)),
                ("change_20d", models.FloatField(blank=True, null=True)),
                ("components", models.JSONField(blank=True, default=list)),
                ("trigger_reasons", models.JSONField(blank=True, default=list)),
                ("stale_components", models.JSONField(blank=True, default=list)),
                ("missing_components", models.JSONField(blank=True, default=list)),
                ("valid_component_count", models.PositiveIntegerField(default=0)),
                ("data_source", models.CharField(default="calculated", max_length=20)),
                ("must_not_use_for_decision", models.BooleanField(default=False)),
                ("blocked_reason", models.TextField(blank=True, default="")),
                ("calculated_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "verbose_name": "Market Thermometer Snapshot",
                "verbose_name_plural": "Market Thermometer Snapshots",
                "db_table": "data_center_market_thermometer_snapshot",
                "ordering": ["-observed_at"],
                "indexes": [
                    models.Index(fields=["band", "observed_at"], name="data_center_band_30e47b_idx")
                ],
            },
        ),
        migrations.CreateModel(
            name="MarketThermometerUserOverrideModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("warm_threshold", models.FloatField(default=35.0)),
                ("hot_threshold", models.FloatField(default=60.0)),
                ("overheat_threshold", models.FloatField(default=75.0)),
                ("extreme_threshold", models.FloatField(default=85.0)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "user",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="market_thermometer_override",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Market Thermometer User Override",
                "verbose_name_plural": "Market Thermometer User Overrides",
                "db_table": "data_center_market_thermometer_user_override",
            },
        ),
    ]
