<?php

namespace Database\Factories;

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

/** @extends Factory<BrentPrice> */
class BrentPriceFactory extends Factory
{
    /** @var array<int, string> */
    private static array $usedDates = [];

    public function definition(): array
    {
        do {
            $date = fake()->dateTimeBetween('-60 days')->format('Y-m-d');
        } while (in_array($date, self::$usedDates, true));

        self::$usedDates[] = $date;

        return [
            'date' => $date,
            'price_usd' => fake()->randomFloat(2, 65, 95),
        ];
    }
}
