<?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::table('categories', function (Blueprint $table) {
            // Tambah kolom brand (untuk filter API Digiflazz)
            $table->string('brand')->nullable()->after('slug')
                ->comment('Brand code untuk filter API (TELKOMSEL, XL, MOBILELEGENDS, dll)');
            
            // Tambah kolom category_type
            $table->string('category_type')->default('game')->after('brand')
                ->comment('Tipe kategori: game, pulsa, data, voucher, dll');
            
            // Tambah kolom untuk metadata
            $table->text('api_filter')->nullable()->after('description')
                ->comment('JSON filter tambahan untuk API (opsional)');
            
            // Index untuk performa
            $table->index('brand');
            $table->index('category_type');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('categories', function (Blueprint $table) {
            $table->dropIndex(['brand']);
            $table->dropIndex(['category_type']);
            $table->dropColumn(['brand', 'category_type', 'api_filter']);
        });
    }
};