<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('layanan_publiks', function (Blueprint $table) {
            $table->string('jenis_permohonan')->nullable();
            $table->string('atas_nama')->nullable();
            $table->string('email')->nullable();
            $table->string('no_hp')->nullable();
            $table->string('judul_tema')->nullable();
            $table->string('tempat_pelaksanaan')->nullable();
            $table->text('keterangan')->nullable();
            $table->integer('jumlah_peserta')->nullable();
            $table->text('nama_peserta')->nullable();
            $table->string('file_ktp')->nullable();
            $table->string('file_ktm')->nullable();
            $table->string('file_id_card')->nullable();
            $table->string('file_kartu_pelajar')->nullable();
            $table->string('file_surat_lokasi')->nullable();
            $table->string('file_surat_keluaran')->nullable();
            
            // Make original columns nullable if they aren't already
            $table->string('nama_lengkap')->nullable()->change();
            $table->string('nik', 16)->nullable()->change();
            $table->string('jenis_layanan')->nullable()->change();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('layanan_publiks', function (Blueprint $table) {
            $table->dropColumn([
                'jenis_permohonan', 'atas_nama', 'email', 'no_hp', 
                'judul_tema', 'tempat_pelaksanaan', 'keterangan', 
                'jumlah_peserta', 'nama_peserta', 'file_ktp', 'file_ktm', 
                'file_id_card', 'file_kartu_pelajar', 'file_surat_lokasi', 
                'file_surat_keluaran'
            ]);
        });
    }
};
