<?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('economic_scenarios', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
            $table->string('name', 120);
            $table->decimal('sale_price_crc_per_kg', 12, 2)->default(3500);
            $table->decimal('expected_mortality_pct', 6, 2)->default(2);
            $table->decimal('feed_cost_variation_pct', 6, 2)->default(0);
            $table->decimal('energy_cost_variation_pct', 6, 2)->default(0);
            $table->decimal('growth_variation_pct', 6, 2)->default(0);
            $table->json('result')->nullable();
            $table->timestamps();
        });
    }

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