<?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('sport_matches', function (Blueprint $table) {
            $table->id();
            $table->string('external_id')->nullable()->unique();
            $table->string('sport'); // football, basketball, tennis, etc.
            $table->string('country')->nullable();
            $table->string('league');
            $table->string('home_team');
            $table->string('away_team');
            $table->decimal('home_odds', 6, 2)->default(1.00);
            $table->decimal('draw_odds', 6, 2)->nullable();
            $table->decimal('away_odds', 6, 2)->default(1.00);
            $table->string('status')->default('upcoming'); // live, upcoming, finished
            $table->timestamp('start_time')->nullable();
            $table->integer('live_minute')->nullable();
            $table->string('home_score')->nullable();
            $table->string('away_score')->nullable();
            $table->string('set_score')->nullable();
            $table->integer('markets_count')->default(1);
            $table->boolean('is_active')->default(true);
            $table->timestamps();
        });
    }

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