<?php

namespace Database\Seeders;

use App\Models\Business;
use App\Models\CollateralCategory;
use Illuminate\Database\Seeder;

class CollateralCategorySeeder extends Seeder
{
    public function run(): void
    {
        $categories = [
            'Television', 'Refrigerator', 'Phone', 'Laptop', 'Bed', 'Sofa',
            'Motorcycle', 'Car', 'Land Documents', 'House Documents', 'Jewellery',
            'Business Equipment', 'Other',
        ];

        Business::query()->each(function (Business $business) use ($categories): void {
            foreach ($categories as $name) {
                CollateralCategory::firstOrCreate(
                    ['business_id' => $business->id, 'name' => $name],
                    ['status' => 'active'],
                );
            }
        });
    }
}
