<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('volatility_regimes', function (Blueprint $table) {
            $table->id();
            $table->dateTime('flipped_on_at');
            $table->dateTime('flipped_off_at')->nullable();
            $table->enum('trigger', ['brent_move', 'llm_event', 'station_churn', 'manual']);
            $table->text('trigger_detail')->nullable();
            $table->boolean('active')->default(true);
            $table->timestamps();

            $table->index(['active', 'flipped_on_at']);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('volatility_regimes');
    }
};
