<?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('sajdahs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('surah_id')->constrained('surahs')->onDelete('cascade');
            $table->foreignId('ayat_id')->nullable()->constrained('ayats')->onDelete('cascade');
            $table->integer('ayah_number'); // Global ayah number
            $table->integer('number_in_surah'); // Ayah number within surah
            $table->text('arabic_text');
            $table->boolean('recommended')->default(false);
            $table->boolean('obligatory')->default(false);
            $table->integer('juz')->nullable();
            $table->integer('manzil')->nullable();
            $table->integer('page')->nullable();
            $table->integer('ruku')->nullable();
            $table->integer('hizb_quarter')->nullable();
            $table->timestamps();
        });
    }

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