<?php

namespace Database\Factories;

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

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

    public function definition(): array
    {
        return [
            'name' => $this->faker->randomElement([
                'Pakan Starter',
                'Pakan Grower',
                'Pakan Layer',
                'Konsentrat Ayam',
                'Jagung Giling',
            ]),
            'unit_id' => Unit::inRandomOrder()->value('id') ?? Unit::factory(),
            'stock' => $this->faker->numberBetween(0, 500),
            'price' => $this->faker->numberBetween(10000, 150000),
        ];
    }
}
