<?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('provider_blocked_days', function (Blueprint $table) {
            $table->id();
            $table->foreignId('provider_id')->constrained('providers')->onDelete('cascade');
            $table->date('date');
            $table->enum('period', ['morning', 'afternoon', 'all']);
            $table->text('reason')->nullable();
            $table->time('init_hour');
            $table->time('end_hour');
            $table->timestamps();
            $table->softDeletes();

            $table->index('provider_id');
        });
    }

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