<?php

namespace Database\Factories;

use App\Models\Order;
use App\Models\ProductVariant;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

class OrderItemFactory extends Factory
{
    public function definition(): array
    {
        $quantity = fake()->numberBetween(1, 50);
        $unitPrice = fake()->numberBetween(1000, 50000);

        return [
            'order_id' => Order::factory(),
            'user_id' => User::factory(),
            'product_variant_id' => ProductVariant::factory(),
            'stock_quality' => 'good',
            'quantity' => $quantity,
            'unit_price' => $unitPrice,
            'subtotal' => $quantity * $unitPrice,
        ];
    }
}
