<?php

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('management_report_recipients', function (Blueprint $table) {
            $table->id();
            $table->string('name')->nullable();
            $table->string('email_address')->unique();
            $table->boolean('is_active')->default(true);
            $table->date('last_report_date')->nullable();
            $table->timestamp('last_sent_at')->nullable();
            $table->timestamps();
            $table->index('is_active');
        });
    }

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