<?php

namespace Database\Factories;

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

class PurchaseItemFactory extends Factory
{
    public function definition(): array
    {
        $quantity = fake()->numberBetween(1, 100);
        $unitPrice = fake()->numberBetween(1000, 100000);

        return [
            'purchase_id' => Purchase::factory(),
            'user_id' => User::factory(),
            'raw_material_price_id' => RawMaterialPrice::factory(),
            'quantity' => $quantity,
            'unit_price' => $unitPrice,
            'subtotal' => (int) ($quantity * $unitPrice),
        ];
    }
}
