<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * Creates the leadership_achievements table to store achievements
     * and accomplishments of leaders during their terms.
     *
     * @return void
     */
    public function up(): void
    {
        Schema::create('leadership_achievements', function (Blueprint $table) {
            // Primary key
            $table->id();

            // Foreign key to leadership histories
            $table->foreignId('leadership_history_id')
                ->constrained('leadership_histories')
                ->onDelete('cascade');

            // Achievement details
            $table->text('achievement_description');
            $table->date('achievement_date');

            // Timestamps
            $table->timestamps();

            // Indexes for performance
            $table->index('leadership_history_id');
            $table->index('achievement_date');
        });
    }

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