<?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('index_manager', function (Blueprint $table) {
            $table->id();
            $table->foreignId('account_id')->constrained('accounts')->cascadeOnDelete();
            $table->string('path', 500);
            $table->enum('index_type', ['inherit', 'no_indexes', 'standard_indexing', 'fancy_indexing'])->default('no_indexes');
            $table->boolean('show_hidden_files')->default(false);
            $table->integer('description_widths')->default(100);
            $table->integer('filename_widths')->default(35);
            $table->boolean('ignore_case')->default(false);
            $table->json('excluded_files')->nullable();
            $table->timestamps();
            $table->unique(['account_id', 'path']);
        });
    }

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