<?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('courses', function (Blueprint $table) {
            $table->id();
            $table->foreignId('category_id')->constrained()->cascadeOnDelete();
            $table->string('slug')->unique();
            $table->string('title');
            $table->string('sub')->nullable();
            $table->text('desc');
            $table->longText('long_desc');
            $table->string('duration');
            $table->unsignedInteger('students')->default(0);
            $table->decimal('rating', 2, 1)->default(5.0);
            $table->string('badge')->nullable();
            $table->string('image')->nullable();
            $table->string('price')->nullable();
            $table->json('includes')->nullable();
            $table->json('requirements')->nullable();
            $table->string('meta_title')->nullable();
            $table->text('meta_description')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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