<?php

use App\Domains\Catalog\Enums\GroupLayout;
use App\Domains\Catalog\Enums\ProductLayout;
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::table('tenants', function (Blueprint $table): void {
            $table->enum('search_product_layout', ProductLayout::values())
                ->default(ProductLayout::ColumnWithImage->value);
            $table->enum('search_group_layout', GroupLayout::values())
                ->default(GroupLayout::Paginated->value);
            $table->unsignedTinyInteger('search_items_per_page')->default(12);
        });
    }

    public function down(): void
    {
        Schema::table('tenants', function (Blueprint $table): void {
            $table->dropColumn([
                'search_product_layout',
                'search_group_layout',
                'search_items_per_page',
            ]);
        });
    }
};
