<?php

namespace Database\Seeders;

use App\Models\KabKota;
use Illuminate\Database\Seeder;

class KabKotaSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $kabKotaList = [
            // Kabupaten (18)
            ['name' => 'Kabupaten Bandung', 'kcd_code' => null], // Belum dimapping
            ['name' => 'Kabupaten Bandung Barat', 'kcd_code' => null],
            ['name' => 'Kabupaten Bekasi', 'kcd_code' => null],
            ['name' => 'Kabupaten Bogor', 'kcd_code' => 'KCD-01'],
            ['name' => 'Kabupaten Ciamis', 'kcd_code' => 'KCD-07'],
            ['name' => 'Kabupaten Cianjur', 'kcd_code' => 'KCD-02'],
            ['name' => 'Kabupaten Cirebon', 'kcd_code' => 'KCD-03'],
            ['name' => 'Kabupaten Garut', 'kcd_code' => null],
            ['name' => 'Kabupaten Indramayu', 'kcd_code' => 'KCD-12'],
            ['name' => 'Kabupaten Karawang', 'kcd_code' => 'KCD-06'],
            ['name' => 'Kabupaten Kuningan', 'kcd_code' => 'KCD-08'],
            ['name' => 'Kabupaten Majalengka', 'kcd_code' => 'KCD-10'],
            ['name' => 'Kabupaten Pangandaran', 'kcd_code' => null],
            ['name' => 'Kabupaten Purwakarta', 'kcd_code' => 'KCD-05'],
            ['name' => 'Kabupaten Subang', 'kcd_code' => 'KCD-13'],
            ['name' => 'Kabupaten Sukabumi', 'kcd_code' => null],
            ['name' => 'Kabupaten Sumedang', 'kcd_code' => 'KCD-09'],
            ['name' => 'Kabupaten Tasikmalaya', 'kcd_code' => 'KCD-11'],
            
            // Kota (9)
            ['name' => 'Kota Bandung', 'kcd_code' => null],
            ['name' => 'Kota Banjar', 'kcd_code' => null],
            ['name' => 'Kota Bekasi', 'kcd_code' => null],
            ['name' => 'Kota Bogor', 'kcd_code' => 'KCD-01'],
            ['name' => 'Kota Cimahi', 'kcd_code' => null],
            ['name' => 'Kota Cirebon', 'kcd_code' => 'KCD-04'],
            ['name' => 'Kota Depok', 'kcd_code' => null],
            ['name' => 'Kota Sukabumi', 'kcd_code' => null],
            ['name' => 'Kota Tasikmalaya', 'kcd_code' => 'KCD-11'],
        ];

        foreach ($kabKotaList as $kabKota) {
            KabKota::updateOrCreate(
                ['name' => $kabKota['name']],
                [
                    'kcd_code' => $kabKota['kcd_code'],
                    'is_active' => true,
                ]
            );
        }
    }
}
