<?php

declare(strict_types=1);

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('disciplinary_reports', function (Blueprint $table): void {
            $table->id();
            $table->foreignId('employee_id')->constrained()->cascadeOnDelete();
            $table->date('report_date');
            $table->string('title');
            $table->text('description');
            $table->string('severity');
            $table->string('attachment_path')->nullable();
            $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
            $table->timestamps();
            $table->softDeletes();

            $table->index('report_date');
            $table->index('severity');
            $table->index(['employee_id', 'report_date']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('disciplinary_reports');
    }
};
