<?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('livre_details', function (Blueprint $table) {
            $table->id();
            $table->foreignId('annonce_id')->constrained()->cascadeOnDelete();
            $table->string('auteur');
            $table->string('genre')->nullable();
            $table->string('editeur')->nullable();
            $table->integer('annee_publication')->nullable();
            $table->decimal('prix', 10, 2)->nullable();
            $table->string('etat')->nullable(); // neuf / occasion
            $table->timestamps();
        });
    }

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