<?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('academy_categories', function (Blueprint $table): void {
            $table->id();
            $table->string('type')->default('lesson');
            $table->string('name');
            $table->string('slug')->unique();
            $table->text('description')->nullable();
            $table->string('icon')->nullable();
            $table->unsignedInteger('order_num')->default(0);
            $table->boolean('active')->default(true);
            $table->timestamps();
            $table->softDeletes();

            $table->index(['type', 'active', 'order_num']);
        });
    }

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