<?php

namespace Database\Seeders;

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

class CategorySeeder extends Seeder
{
    public function run(): void
    {
        $now = now();

        $categories = [
            ['name' => 'Data SME', 'slug' => 'data_sme'],
            ['name' => 'Data Gifting', 'slug' => 'data_gifting'],
            ['name' => 'Data Corporate Gifting', 'slug' => 'data_cg'],
            ['name' => 'Data Direct', 'slug' => 'data_direct'],
            ['name' => 'Airtime VTU', 'slug' => 'airtime_vtu'],
            ['name' => 'Cable', 'slug' => 'cable'],
            ['name' => 'Electricity', 'slug' => 'electricity'],
            ['name' => 'Education Pins', 'slug' => 'epin'],
        ];

        foreach ($categories as $category) {
            DB::table('categories')->updateOrInsert(
                ['slug' => $category['slug']],
                [
                    'name' => $category['name'],
                    'slug' => $category['slug'],
                    'created_at' => $now,
                    'updated_at' => $now,
                ]
            );
        }
    }
}

