<?php

namespace Database\Factories;

use App\Models\WineProduction;
use App\Models\Wine;
use App\Models\Harvest;
use Illuminate\Database\Eloquent\Factories\Factory;

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

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'wine_id' => Wine::factory(),
            'harvest_id' => Harvest::factory(),
            'consumed_weight' => fake()->randomFloat(2, 100.0, 1000.0),
            'blend_percentage' => fake()->randomFloat(2, 10.0, 100.0),
        ];
    }

    /**
     * Indicate that this is a single-variety wine (100% blend).
     */
    public function singleVariety(): static
    {
        return $this->state(fn (array $attributes) => [
            'blend_percentage' => 100.00,
        ]);
    }
}
