<?php

namespace Database\Factories;

use App\Models\AttendanceEvent;
use App\Models\Employee;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/**
 * @extends Factory<AttendanceEvent>
 */
class AttendanceEventFactory extends Factory
{
    protected $model = AttendanceEvent::class;

    public function definition(): array
    {
        return [
            'event_uuid' => (string) Str::uuid(),
            'employee_id' => Employee::factory(),
            'device_id' => null,
            'site_id' => Site::factory(),
            'direction' => 'IN',
            'ts' => now(),
            'confidence' => 0.9,
            'liveness_pass' => true,
            'source' => 'face',
            'operator' => null,
            'direction_confidence' => 0.8,
        ];
    }

    public function manual(): static
    {
        return $this->state(fn (array $attributes) => [
            'source' => 'manual',
            'confidence' => 1.0,
            'direction_confidence' => 1.0,
        ]);
    }
}
