<?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('projects', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->text('description')->nullable();
            $table->enum('contribution_type', ['fixe', 'variable'])->default('fixe');
            $table->decimal('amount', 15, 2);
            $table->enum('frequency', ['mensuelle', 'hebdomadaire', 'annuelle', 'personnalisee'])->default('mensuelle');
            $table->integer('custom_frequency_days')->nullable()->comment('Nombre de jours pour fréquence personnalisée');
            $table->date('start_date');
            $table->date('end_date')->nullable();
            $table->enum('status', ['actif', 'termine'])->default('actif');
            $table->boolean('is_public')->default(false)->comment('Visible sur le site vitrine');
            $table->timestamps();
        });
    }

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