<?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('rapports', function (Blueprint $table) {
            $table->id();

            $table->date('date_inspection');
            $table->string('classe_visitee');
            $table->integer('nombre_eleve');
            $table->integer('present');
            $table->string('horaire');
            $table->string('passation');
            $table->string('titre_lecon');
            $table->string('deroulement');
            $table->string('appreciation_generale');
            $table->integer('numero_ordre');
            $table->float('note'); 
            $table->unsignedBigInteger('etablissement_id');
            $table->foreign('etablissement_id')->references('id')->on('etablissements')
            ->constrained()
            ->onUpdate('restrict')
            ->onDelete('restrict'); 
            $table->unsignedBigInteger('professeur_id');
            $table->foreign('professeur_id')->references('id')->on('professeurs')
            ->constrained()
            ->onUpdate('restrict')
            ->onDelete('restrict'); 
            $table->unsignedBigInteger('inspecteur_id');
            $table->foreign('inspecteur_id')->references('id')->on('inspecteurs')
            ->constrained()
            ->onUpdate('restrict')
            ->onDelete('restrict'); 
            $table->timestamps();
        });
    }

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