<?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('polls', function (Blueprint $table) {
            $table->id();
            $table->string('question');
            $table->json('options');                        // ["Messi","Mbappe","Ronaldo"]
            $table->enum('type', ['daily', 'match', 'mood'])->default('daily');
            $table->foreignId('football_match_id')
                  ->nullable()
                  ->constrained('football_matches')
                  ->nullOnDelete();
            $table->boolean('is_active')->default(true);
            $table->date('poll_date')->nullable();          // which day this poll appears
            $table->timestamps();
        });
    }

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