<?php

namespace Database\Factories;

use App\Models\EggPrice;
use App\Models\Unit;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories.Factory<\App\Models\EggPrice>
 */
class EggPriceFactory extends Factory
{
    protected $model = EggPrice::class;

    public function definition(): array
    {
        $unit = Unit::inRandomOrder()->first() ?? Unit::factory()->create();

        return [
            'name' => $this->faker->randomElement(['Ecer', 'Grosir', 'Distributor']).' '.$this->faker->randomElement(['Pagi', 'Siang', 'Malam']),
            'unit_id' => $unit->id,
            'price' => $this->faker->numberBetween(1500, 3000),
        ];
    }
}
