<?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('company_targets', function (Blueprint $table) {
            $table->uuid('id')->primary();
            $table->string('metric'); // 'revenue', 'investors', 'aum'
            $table->string('period_type'); // 'year', 'quarter', 'month'
            $table->string('period_value'); // '2025', 'Q1', 'Jan'
            $table->decimal('target_value', 15, 2);
            $table->decimal('achieved_value', 15, 2)->nullable();
            $table->timestamps();

            $table->index(['metric', 'period_type', 'period_value']);
        });
    }

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