<?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('raffles', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->text('description');
            $table->decimal('commercial_value', 15, 2);
            $table->decimal('fiscal_value', 15, 2);
            $table->decimal('ticket_price', 15, 2)->default(1500.00);
            $table->timestamp('draw_date');
            $table->integer('total_tickets');
            $table->integer('sold_tickets')->default(0);
            $table->enum('status', ['draft', 'active', 'completed', 'cancelled'])->default('draft');
            $table->enum('type', ['main', 'secondary'])->default('main');
            $table->text('rules')->nullable();
            $table->string('invoice_path')->nullable();
            $table->string('vehicle_docs_path')->nullable();
            $table->string('marchamo_path')->nullable();
            $table->string('inspection_path')->nullable();
            $table->json('images_json')->nullable();
            $table->string('video_url')->nullable();
            $table->timestamps();
        });
    }

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