<?php

namespace Database\Seeders;

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

class AttendanceSettingSeeder extends Seeder
{
    public function run(): void
    {
        $settings = [
            ['key' => 'company_name', 'value' => 'PT Inovasi Digital Nusantara', 'description' => 'Nama Perusahaan'],
            ['key' => 'work_days', 'value' => '1,2,3,4,5', 'description' => 'Hari Kerja Aktif (1=Senin..7=Minggu)'],
            ['key' => 'default_radius_meters', 'value' => '100', 'description' => 'Radius Default Absensi (Meter)'],
            ['key' => 'require_gps', 'value' => 'true', 'description' => 'Wajib Menggunakan GPS'],
            ['key' => 'require_selfie', 'value' => 'true', 'description' => 'Wajib Foto Selfie'],
            ['key' => 'late_tolerance_minutes', 'value' => '10', 'description' => 'Toleransi Keterlambatan (Menit)'],
            ['key' => 'check_in_start_time', 'value' => '06:00', 'description' => 'Batas Mulai Absen Masuk'],
            ['key' => 'check_in_end_time', 'value' => '12:00', 'description' => 'Batas Akhir Absen Masuk'],
            ['key' => 'check_out_start_time', 'value' => '16:00', 'description' => 'Batas Mulai Absen Pulang'],
            ['key' => 'check_out_end_time', 'value' => '23:59', 'description' => 'Batas Akhir Absen Pulang'],
            ['key' => 'whatsapp_enabled', 'value' => 'false', 'description' => 'Status Notifikasi WhatsApp'],
            ['key' => 'whatsapp_provider', 'value' => 'fonnte', 'description' => 'Provider Gateway WhatsApp'],
            ['key' => 'whatsapp_reminder_enabled', 'value' => 'false', 'description' => 'Reminder Absen WhatsApp Otomatis'],
            ['key' => 'whatsapp_reminder_time', 'value' => '08:30', 'description' => 'Waktu Reminder Absen'],
            ['key' => 'whatsapp_template_checkin', 'value' => "{nama}\nmasuk", 'description' => 'Template Pesan WhatsApp Check-In'],
            ['key' => 'whatsapp_template_checkout', 'value' => "{nama}\npulang", 'description' => 'Template Pesan WhatsApp Check-Out'],
            ['key' => 'whatsapp_template_late', 'value' => "{nama}\nterlambat {jumlah_menit} menit", 'description' => 'Template Pesan WhatsApp Terlambat'],
            ['key' => 'whatsapp_template_reminder', 'value' => "Halo {nama},\nJangan lupa absen masuk hari ini ya.", 'description' => 'Template Pesan WhatsApp Reminder'],
        ];

        foreach ($settings as $setting) {
            AttendanceSetting::updateOrCreate(['key' => $setting['key']], $setting);
        }
    }
}
