<?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
    {
        // Une case du planning : une semaine/jour donnée du programme, optionnellement liée à une routine.
        Schema::create('program_slots', function (Blueprint $table) {
            $table->id();
            $table->foreignId('program_id')->constrained();
            $table->unsignedInteger('week'); // 1..duration_weeks
            $table->unsignedTinyInteger('weekday'); // 1 (lundi) .. 7 (dimanche)
            $table->foreignId('routine_id')->nullable()->constrained();
            $table->string('label')->nullable();
            $table->timestamps();
        });
    }

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