<?php

namespace Database\Factories;

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

/** @extends Factory<Geofence> */
class GeofenceFactory extends Factory
{
    protected $model = Geofence::class;

    public function definition(): array
    {
        return [
            'uuid' => (string) Str::uuid(),
            'device_id' => Device::factory(),
            'user_id' => fn (array $attributes) => Device::query()->find($attributes['device_id'])?->user_id,
            'geofence_name' => fake()->unique()->words(2, true),
            'category' => fake()->randomElement(['safe_zone', 'restricted_area', 'home', 'office', 'school', 'parking']),
            'latitude' => fake()->latitude(8, 37),
            'longitude' => fake()->longitude(68, 97),
            'radius' => fake()->numberBetween(50, 5000),
            'entry_notification' => true,
            'exit_notification' => true,
            'is_active' => true,
        ];
    }
}
