<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('ayats', function (Blueprint $table) {
            $table->id();
            $table->foreignId('surah_id')->constrained('surahs')->onDelete('cascade');
            $table->integer('ayah_no'); // Ayah number within the surah
            $table->integer('ayah_number')->nullable(); // Global ayah number
            $table->text('arabic_text');
            $table->text('arabic_text_simple')->nullable();
            $table->text('english_translation');
            $table->text('transliteration')->nullable();
            $table->integer('juz')->nullable();
            $table->integer('manzil')->nullable();
            $table->integer('page')->nullable();
            $table->integer('ruku')->nullable();
            $table->integer('hizb_quarter')->nullable();
            $table->timestamps();
            
            $table->index(['surah_id', 'ayah_no']);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('ayats');
    }
};
