<?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('news', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->text('summary');
            $table->string('image_url')->nullable();
            $table->string('external_url');
            $table->enum('category', [
                'breaking', 'preview', 'review', 'team', 'highlight'
            ])->default('breaking');
            $table->string('youtube_url')->nullable();
            $table->boolean('is_published')->default(true);
            $table->foreignId('related_team_id')
                  ->nullable()
                  ->constrained('teams')
                  ->nullOnDelete();
            $table->timestamps();
        });
    }

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