<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class ModuleSeeder extends Seeder
{
    public function run(): void
    {
        $modules = [
            'payroll' => 'Payroll',
            'attendance' => 'Attendance',
            'leave' => 'Leave',
            'loan' => 'Loan',
            'advance_salary' => 'Advance Salary',
            'task_management' => 'Task Management',
            'contract_management' => 'Contract Management',
            'finance' => 'Finance',
            'mobile_app_access' => 'Mobile App Access',
            'api_access' => 'API Access',
            'face_recognition' => 'Face Recognition',
            'gps_attendance' => 'GPS Attendance',
            'holiday_ot' => 'Holiday OT',
            'multi_branch' => 'Multi Branch',
            'shift_management' => 'Shift Management',
        ];

        foreach ($modules as $key => $name) {
            DB::table('modules')->updateOrInsert(
                ['module_key' => $key],
                ['name' => $name, 'globally_enabled' => true, 'updated_at' => now(), 'created_at' => now()]
            );
        }
    }
}
