<?php

namespace Database\Seeders;

use App\Models\AssetType;
use Illuminate\Database\Seeder;

class AssetTypeSeeder extends Seeder
{
    public function run(): void
    {
        $types = [
            [
                'name' => 'Laptop',
                'description' => 'Portable computing device assigned to employees for daily work.',
            ],
            [
                'name' => 'Desktop Computer',
                'description' => 'Fixed workstation for office-based employees and support staff.',
            ],
            [
                'name' => 'Monitor',
                'description' => 'Display screen used with desktops or docked laptops.',
            ],
            [
                'name' => 'Keyboard & Mouse',
                'description' => 'Input peripherals for workstations and shared devices.',
            ],
            [
                'name' => 'Mobile Phone',
                'description' => 'Company-issued smartphone for communication and mobile access.',
            ],
            [
                'name' => 'Headset / Headphone',
                'description' => 'Audio device for calls, online meetings, and customer support.',
            ],
            [
                'name' => 'IP Phone / VOIP Phone',
                'description' => 'Desk phone for internal and external voice communication.',
            ],
            [
                'name' => 'Networking Equipment',
                'description' => 'Routers, switches, access points, and network infrastructure.',
            ],
            [
                'name' => 'UPS / Power Backup',
                'description' => 'Uninterruptible power supply unit to protect systems from outages.',
            ],
            [
                'name' => 'Server',
                'description' => 'On-premise server hardware for hosting, storage, or compute.',
            ],
            [
                'name' => 'Software License',
                'description' => 'Licensed software subscription or perpetual license seat.',
            ],
            [
                'name' => 'Office Furniture',
                'description' => 'Desks, ergonomic chairs, cabinets, and storage units.',
            ],
        ];

        // Seed under company_id = 2 (Kiyo Solutions Pvt Ltd — info@kiyosolutions.com)
        // CompanyScope filters by company_id, so null-scoped records are invisible.
        $companyId = 2;

        foreach ($types as $type) {
            AssetType::withoutGlobalScopes()->firstOrCreate(
                ['name' => $type['name'], 'company_id' => $companyId],
                ['description' => $type['description'], 'company_id' => $companyId]
            );
        }
    }
}
