<?php

namespace Database\Seeders;

use App\Models\ProductCategory;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

class ProductCategorySeeder extends Seeder
{
    public function run(): void
    {
        $categories = [
            ['name' => 'Canlı Yem', 'icon' => 'worm', 'sort_order' => 1],
            ['name' => 'Yapay Yem', 'icon' => 'fish', 'sort_order' => 2],
            ['name' => 'Balık Malzemeleri', 'icon' => 'package', 'sort_order' => 3],
            ['name' => 'Olta ve Ekipman', 'icon' => 'anchor', 'sort_order' => 4],
        ];

        foreach ($categories as $category) {
            $slug = Str::slug($category['name']);
            ProductCategory::updateOrCreate(
                ['slug' => $slug],
                array_merge($category, [
                    'supports_product_reservations' => $slug === 'canli-yem',
                ]),
            );
        }
    }
}
