<?php

namespace Database\Seeders;

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

class EssentialSeeder extends Seeder
{
    public function run(): void
    {
        $organization = Organization::query()->firstOrCreate(
            ['slug' => 'smart-clinic'],
            [
                'name' => 'Smart Clinic',
                'timezone' => 'Asia/Karachi',
                'is_active' => true,
            ]
        );

        $settings = [
            'token_scope' => 'doctor_location',
            'token_start' => 1,
            'token_min' => 1,
            'token_max' => 9999,
            'reminder_offsets_minutes' => [1440, 120],
            'patient_self_booking_enabled' => false,
            'appointment_types' => ['new_consultation', 'follow_up', 'routine', 'emergency'],
            'payment_methods' => ['cash', 'card', 'bank_transfer', 'online', 'insurance'],
        ];

        foreach ($settings as $key => $value) {
            Setting::query()->firstOrCreate(
                ['organization_id' => $organization->id, 'key' => $key],
                ['value' => $value]
            );
        }
    }
}
