<?php

namespace Database\Factories;

use App\Models\Device;
use App\Models\DeviceSecurityLog;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/** @extends Factory<DeviceSecurityLog> */
class DeviceSecurityLogFactory extends Factory
{
    protected $model = DeviceSecurityLog::class;

    public function definition(): array
    {
        return [
            'uuid' => (string) Str::uuid(),
            'device_id' => Device::factory(),
            'security_event' => 'security_scan',
            'security_level' => 'low',
            'event_source' => 'device',
            'event_data' => json_encode(['result' => 'passed'], JSON_THROW_ON_ERROR),
            'payload_hash' => hash('sha256', 'security-scan-passed'),
            'created_at' => now(),
        ];
    }
}
