<?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('subtitles', function (Blueprint $table) {
            $table->id();
            $table->foreignId('episode_id')->constrained('episodes')->cascadeOnDelete();
            $table->string('language', 10)->default('tr');   // tr, en, jp
            $table->string('label')->default('Türkçe');      // Görünen ad
            $table->string('url');                           // VTT dosya URL'si
            $table->boolean('is_default')->default(false);
            $table->timestamps();
            $table->unique(['episode_id', 'language']);
        });
    }

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