<?php

namespace Database\Seeders;

use App\Models\StaffHistory;
use App\Models\Organization;
use Illuminate\Database\Seeder;

class StaffHistorySeeder extends Seeder
{
    public function run(): void
    {
        $organization = Organization::first();

        if (!$organization) {
            $this->call(OrganizationSeeder::class);
            $organization = Organization::first();
        }

        $experts = [
            [
                'staff_name' => 'Prof Dr. Kennedy Anaswa Musee',
                'position' => 'Founder & President',
                'employment_start_date' => '2010-01-01',
                'employment_status' => 'current',
                'passport_path' => null,
            ],
            [
                'staff_name' => 'Dr.HC George Asiago Masagara',
                'position' => 'Accredited Mediator',
                'employment_start_date' => '2012-03-15',
                'employment_status' => 'current',
                'passport_path' => null,
            ],
            [
                'staff_name' => 'Dr.HC Lister Mokeira Nyamasege',
                'position' => 'Accredited Mediator',
                'employment_start_date' => '2013-06-01',
                'employment_status' => 'current',
                'passport_path' => null,
            ],
            [
                'staff_name' => 'Mr. Davis Wafula',
                'position' => 'Accredited Mediator',
                'employment_start_date' => '2014-09-01',
                'employment_status' => 'current',
                'passport_path' => null,
            ],
            [
                'staff_name' => 'Dr.HC Joakim Mulama Oundo',
                'position' => 'Accredited Mediator',
                'employment_start_date' => '2015-02-01',
                'employment_status' => 'current',
                'passport_path' => null,
            ],
            [
                'staff_name' => 'Rev. Ben Barasa',
                'position' => 'Accredited Mediator',
                'employment_start_date' => '2016-04-15',
                'employment_status' => 'current',
                'passport_path' => null,
            ],
            [
                'staff_name' => 'Dr.HC John King\'oina Onyiego',
                'position' => 'Accredited Mediator',
                'employment_start_date' => '2017-01-01',
                'employment_status' => 'current',
                'passport_path' => null,
            ],
        ];

        foreach ($experts as $expert) {
            StaffHistory::create(array_merge($expert, [
                'organization_id' => $organization->id,
            ]));
        }
    }
}
