<?php

namespace Database\Factories;

use App\Models\Invoice;
use App\Models\InvoiceItem;
use Illuminate\Database\Eloquent\Factories\Factory;

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

    public function definition(): array
    {
        $unitPrice = fake()->randomFloat(2, 10, 500);

        return [
            'invoice_id' => Invoice::factory(),
            'type' => 'recurring',
            'description' => fake()->sentence(3),
            'quantity' => 1,
            'unit_price' => $unitPrice,
            'setup_fee' => 0,
            'total' => $unitPrice,
            'line_total' => $unitPrice,
            'tax_rate' => 0,
            'tax_amount' => 0,
            'discount_rate' => 0,
            'discount_amount' => 0,
            'config_options_total' => 0,
        ];
    }
}
