<?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('price_predictions', function (Blueprint $table) {
            $table->id();
            $table->date('predicted_for')->comment('The date this prediction covers');
            $table->enum('source', ['llm', 'llm_with_context', 'ewma']);
            $table->enum('direction', ['rising', 'falling', 'flat']);
            $table->tinyInteger('confidence')->unsigned()->comment('0–100 confidence score');
            $table->text('reasoning')->nullable()->comment('LLM explanation or EWMA summary');
            $table->datetime('generated_at');

            $table->index(['predicted_for', 'source']);
        });
    }

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