<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('gurus', function (Blueprint $table) {
            // Menambahkan jenis identitas (Enum)
            $table->enum('jenis_identitas', ['NIP', 'NRG', 'NPK', 'page.id'])
                ->default('NIP')
                ->after('nama'); // Diletakkan setelah kolom nama

            // Menambahkan nomor identitas (String)
            $table->string('nomor_identitas')
                ->nullable() // Dibuat nullable dulu agar data lama tidak error
                ->unique()
                ->after('jenis_identitas');

            // Menambahkan jenis kelamin
            $table->enum('jenis_kelamin', ['L', 'P'])
                ->after('nomor_identitas');
        });
    }

    public function down(): void
    {
        Schema::table('gurus', function (Blueprint $table) {
            $table->dropColumn(['jenis_identitas', 'nomor_identitas', 'jenis_kelamin']);
        });
    }
};
