<?php

namespace Database\Factories;

use App\Models\Purchase;
use App\Models\User;
use App\Models\Wine;
use Illuminate\Database\Eloquent\Factories\Factory;

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

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $statuses = ['pending', 'completed', 'cancelled'];

        return [
            'user_id' => User::factory(),
            'wine_id' => Wine::factory(),
            'amount' => fake()->numberBetween(1, 12),
            'price' => fake()->randomFloat(2, 20.0, 500.0),
            'status' => fake()->randomElement($statuses),
            'purchased_at' => fake()->optional()->dateTimeBetween('-1 month', 'now'),
            'note' => fake()->optional()->sentence(8),
        ];
    }
}
