<?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('equity_plans', function (Blueprint $table) {
            $table->id();
            $table->foreignId('organisation_id')->constrained()->cascadeOnDelete();

            $table->string('name'); // e.g., "2025 RSU Grant Plan"
            $table->enum('equity_type', ['stock', 'cash', 'mixed'])->default('stock');
            $table->decimal('share_price', 12, 2)->nullable();
            $table->integer('vesting_period_months')->default(36);
            $table->boolean('active')->default(true);

            $table->date('start_date')->nullable();
            $table->date('end_date')->nullable();

            $table->text('description')->nullable();

            $table->timestamps();
        });

    }

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