<?php

use App\Models\CountryLocale;
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('categories', function (Blueprint $table) {
            $table->id();
            $table->foreignIdFor(CountryLocale::class);
            $table->string('name')->nullable();
            $table->string('short_name')->nullable();
            $table->string('slug')->nullable();
            $table->boolean('enabled')->default(true);
            $table->boolean('is_top')->default(true);
            $table->nestedSet();
            $table->softDeletes();
            $table->timestamps();

            $table->foreign('country_locale_id')->references('id')->on('country_locales');
        });
    }

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