<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('jenis_surats', function (Blueprint $table) {
            $table->id();
            $table->string('nama')->unique();
            $table->timestamps();
        });

        // Seed initial data
        $categories = [
            'Pengajuan Surat Keterangan Domisili',
            'Pengajuan Surat Keterangan Usaha',
            'Pengajuan Surat Keterangan Kematian',
            'Pengajuan Surat Keterangan Tidak Mampu (SKTM)',
            'Pengajuan Surat Keterangan Penghasilan Orang Tua',
            'Pengajuan Surat Keterangan Pindah/Datang WNI',
            'Pengajuan Surat Keterangan Kehilangan',
            'Pengajuan Surat Keterangan Kuasa Ahli Waris',
            'Pengajuan Surat Keterangan Jual Beli Tanah',
            'Pengajuan Surat Keterangan Pengantar Perkawinan',
            'Pengajuan Surat Keterangan Belum Menikah',
            'Pengajuan Surat Keterangan Hibah/Wakaf',
            'Lainnya',
        ];

        foreach ($categories as $category) {
            DB::table('jenis_surats')->insert([
                'nama' => $category,
                'created_at' => now(),
                'updated_at' => now(),
            ]);
        }
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('jenis_surats');
    }
};
