<?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('lms_course_settings', function (Blueprint $table) {
            $table->id();
            $table->foreignId('course_id')->constrained('lms_courses')->cascadeOnDelete();
            $table->boolean('certificate_enabled')->default(false);
            $table->enum('certificate_template', ['classic', 'modern'])->default('classic');
            $table->boolean('badge_enabled')->default(false);
            $table->integer('retakes')->default(1);
            $table->text('instructions')->nullable();
            $table->text('completion_message')->nullable();
            $table->timestamps();
            
            // Indexes
            $table->unique('course_id');
        });
    }

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