<?php

namespace Database\Seeders;

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

class QrSettingSeeder extends Seeder
{
    public function run(): void
    {
        $now = CarbonImmutable::now();

        $settings = [
            ['key' => 'qr_validity_minutes', 'value' => '120', 'is_active' => true],
        ];

        foreach ($settings as $setting) {
            DB::table('qr_settings')->updateOrInsert(
                ['key' => $setting['key']],
                array_merge($setting, ['created_at' => $now, 'updated_at' => $now])
            );
        }

        $this->command->info("QR Settings seeded: " . count($settings) . " records");
    }
}
