<?php

namespace Database\Factories;

use App\Models\Search;
use Illuminate\Database\Eloquent\Factories\Factory;

/** @extends Factory<Search> */
class SearchFactory extends Factory
{
    public function definition(): array
    {
        $lowest = fake()->numberBetween(12000, 15000);
        $highest = $lowest + fake()->numberBetween(100, 3000);

        return [
            'lat_bucket' => round(fake()->latitude(49.9, 60.9), 2),
            'lng_bucket' => round(fake()->longitude(-8.2, 1.8), 2),
            'fuel_type' => fake()->randomElement(['b7_standard', 'e10', 'e5']),
            'results_count' => fake()->numberBetween(5, 100),
            'lowest_pence' => $lowest,
            'highest_pence' => $highest,
            'avg_pence' => round(($lowest + $highest) / 2, 2),
            'searched_at' => now(),
            'ip_hash' => hash('sha256', fake()->ipv4()),
        ];
    }
}
