<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class InvoiceSeeder extends Seeder
{
    public function run(): void
    {
        $invoiceId = DB::table('invoices')->insertGetId([
            'invoice_number' => 'INV-001',
            'customer_id' => 1,
            'invoice_date' => now(),
            'due_date' => now()->addDays(7),
            'status' => 'sent',
            'subtotal' => 100000,
            'tax' => 11000,
            'total' => 111000,
            'created_at' => now(),
            'updated_at' => now()
        ]);

        DB::table('invoice_items')->insert([
            [
                'invoice_id' => $invoiceId,
                'description' => 'Jasa Website',
                'quantity' => 1,
                'unit_price' => 100000,
                'total_price' => 100000,
                'created_at' => now(),
                'updated_at' => now()
            ],
            [
                'invoice_id' => $invoiceId,
                'description' => 'Maintenance',
                'quantity' => 1,
                'unit_price' => 50000,
                'total_price' => 50000,
                'created_at' => now(),
                'updated_at' => now()
            ]
        ]);
    }
}