<?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('carousel_items', function (Blueprint $table) {
            $table->id();
            $table->string('titulo')->nullable();
            $table->string('subtitulo')->nullable();
            $table->string('boton_texto')->nullable();
            $table->string('boton_enlace')->nullable();
            $table->string('imagen');
            $table->integer('orden')->default(0);
            $table->boolean('activo')->default(true);
            $table->timestamps();
        });

        // Insert default items to preserve the first 3 original items
        DB::table('carousel_items')->insert([
            [
                'titulo' => 'Bienvenido a OnAPB',
                'subtitulo' => 'La nueva forma de vivir el básquet en Paraná',
                'boton_texto' => 'Ver partidos',
                'boton_enlace' => '/eventos',
                'imagen' => 'hero1.jpeg',
                'orden' => 1,
                'activo' => true,
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'titulo' => 'El basquet en tus manos',
                'subtitulo' => 'Seguilo como nunca antes',
                'boton_texto' => 'Unite',
                'boton_enlace' => '/asociate',
                'imagen' => 'hero2.jpg',
                'orden' => 2,
                'activo' => true,
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'titulo' => 'Sumate a la comunidad',
                'subtitulo' => 'Asociate y disfrutá beneficios exclusivos',
                'boton_texto' => 'Lugares',
                'boton_enlace' => '/promos',
                'imagen' => 'hero3.jpg',
                'orden' => 3,
                'activo' => true,
                'created_at' => now(),
                'updated_at' => now(),
            ]
        ]);
    }

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