<?php

namespace Database\Seeders;

use App\Models\Invoice;
use App\Models\Order;
use Illuminate\Database\Seeder;

class InvoiceSeeder extends Seeder
{
    public function run(): void
    {
        $orders = Order::all();
        $statuses = ['generated', 'sent'];

        foreach ($orders as $order) {
            Invoice::create([
                'order_id' => $order->id,
                'invoice_number' => 'INV-' . strtoupper(uniqid()),
                'status' => $statuses[array_rand($statuses)],
                'pdf_path' => 'invoices/invoice-' . $order->order_number . '.pdf',
            ]);
        }
    }
}