<?php

namespace Database\Factories;

use App\Models\Employee;
use App\Models\FaceTemplate;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<FaceTemplate>
 */
class FaceTemplateFactory extends Factory
{
    protected $model = FaceTemplate::class;

    public function definition(): array
    {
        $vector = array_fill(0, 512, 0.01);
        $embedding = base64_encode(pack('f*', ...$vector));

        return [
            'employee_id' => Employee::factory(),
            'embedding_b64' => $embedding,
            'dim' => 512,
            'model' => 'buffalo_l/arcface',
            'quality' => 0.9,
            'version' => 1,
            'active' => true,
        ];
    }

    public function inactive(): static
    {
        return $this->state(fn (array $attributes) => ['active' => false]);
    }
}
