<?php

use App\Http\Controllers\RegisterUserController;
use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return redirect('/admin');
});


Route::get('/register', [RegisterUserController::class, 'showRegistrationForm'])->name('register');
Route::post('/register', [RegisterUserController::class, 'register']);
Route::get('/register/success', [RegisterUserController::class, 'showRegistrationSuccess'])->name('register.success');

// Route::get('/surat-kelahiran', function () {
//     // Create a dummy record object
//     $record = (object) [
//         'nomor_surat' => '470/SK.001/DS.RKJ/V/2025',
//         'nama_bayi' => 'Bayi Dummy',
//         'tempat_lahir_bayi' => 'Bogor',
//         'tanggal_lahir_bayi' => '2025-05-30', // Use a string date
//         'jenis_kelamin_bayi' => 'laki-laki',
//         'berat_bayi_kg' => 3.5,
//         'panjang_bayi_cm' => 50,
//         'anak_ke' => 1,
//         'nama_pelapor' => 'Pelapor Dummy',
//         'nik_pelapor' => '1234567890123456',
//         'hubungan_pelapor_dengan_bayi' => 'Orang Tua',
//         'status' => 'disetujui',
//         // Dummy relationships
//         'ayah' => (object) ['nama' => 'Ayah Dummy'],
//         'ibu' => (object) ['nama' => 'Ibu Dummy'],
//         'penduduk' => (object) [
//             'nama' => 'Bayi Dummy',
//             'nik' => '1234567890123457',
//             'kartuKeluarga' => (object) ['alamat_lengkap' => 'Jl. Dummy No. 1, Desa Dummy, Kec. Dummy, Kab. Dummy']
//         ],
//     ];

//     // Replace placeholders in the HTML
//     $htmlContent = view('pdf.surat_kelahiran', compact('record'))->render();
//     $htmlContent = str_replace('[NAMA DESA ANDA]', 'Raksajaya', $htmlContent);
//     $htmlContent = str_replace('[NAMA KECAMATAN ANDA]', 'Cileungsi', $htmlContent);
//     $htmlContent = str_replace('[NAMA KABUPATEN ANDA]', 'Bogor', $htmlContent);

//     return $htmlContent;
// });
