<?php

namespace Database\Seeders;

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

/**
 * Default expense categories so the module is usable out of the box.
 * Idempotent — keyed by name; re-running never duplicates. A category
 * management UI (add/edit/retire) is a later slice.
 */
class ExpenseCategoriesSeeder extends Seeder
{
    public function run(): void
    {
        $names = [
            'Rent',
            'Utilities',
            'Salaries & Wages',
            'Supplies',
            'Maintenance & Repairs',
            'Marketing',
            'Transport',
            'Bank Charges',
            'Miscellaneous',
        ];

        foreach ($names as $name) {
            DB::table('expense_categories')->updateOrInsert(['name' => $name], ['is_active' => true]);
        }
    }
}
