<?php

namespace Database\Seeders;

use App\Models\SalaryComponent;
use Illuminate\Database\Seeder;

class SalaryComponentSeeder extends Seeder
{
    public function run(): void
    {
        $components = [
            ['name' => 'Basic', 'type' => 'earning'],
            ['name' => 'Medical', 'type' => 'earning'],
            ['name' => 'House Rent', 'type' => 'earning'],
            ['name' => 'Conveyance', 'type' => 'earning'],
        ];

        foreach ($components as $component) {
            SalaryComponent::updateOrCreate(['name' => $component['name']], [
                'type' => $component['type'],
                'status' => true,
            ]);
        }
    }
}
