<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * Adds blue_tickets_collected and wheel_free_spins columns to account table.
     * Blue tickets are earned with 10% chance when buying regular tickets.
     * Every 5 blue tickets collected automatically converts to 10 free small wheel spins.
     */
    public function up(): void
    {
        Schema::connection('account')->table('account', function (Blueprint $table) {
            $table->unsignedInteger('blue_tickets_collected')->default(0)
                  ->after('mileage')
                  ->comment('Total blue tickets collected from tombola (every 5 converts to 10 wheel spins)');
            $table->unsignedInteger('wheel_free_spins')->default(0)
                  ->after('blue_tickets_collected')
                  ->comment('Available free spins for small wheel (earned from blue tickets)');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::connection('account')->table('account', function (Blueprint $table) {
            $table->dropColumn(['blue_tickets_collected', 'wheel_free_spins']);
        });
    }
};
