<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\DataPasienController;
use App\Http\Controllers\DataVaksinController;
use App\Http\Controllers\DataLaporanController;
use App\Http\Controllers\DataPeriksaController;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\DataVitaminController;
use Illuminate\Support\Facades\Auth;
use SebastianBergmann\CodeCoverage\Report\Html\Dashboard;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

// Route::get('/', function () {
//     return view('welcome');
// });
// Route::get('/', [AuthController::class, 'index']);

Route::get('/', [AuthController::class, 'index'])->name('login')->middleware('guest');
Route::post('/login', [AuthController::class, 'authenticate']);
Route::post('/logout', [AuthController::class, 'logout']);

Route::get('/dashboard', [DashboardController::class, 'index'])->middleware('auth');

Route::get('/tambah_pasien', [DataPasienController::class, 'create'])->middleware('auth');
Route::post('/tambah_pasien/create', [DataPasienController::class, 'store'])->middleware('auth');

Route::get('/data_pasien', [DataLaporanController::class, 'index'])->middleware('auth');
Route::delete('/data_ibu_hamil/{id}/delete', [DataLaporanController::class, 'destroy'])->middleware('auth');

Route::get('/data_pasien/{id}', [DataLaporanController::class, 'preview'])->middleware('auth');
Route::patch('/edit_biodata/{id}/edit', [DataLaporanController::class, 'update_ibu_hamil'])->middleware('auth');
Route::delete('/data_hamil_ke/{id}/delete', [DataLaporanController::class, 'destroy_hamil_ke'])->middleware('auth');
Route::post('/tambah_status_ibu_hamil/{id}/create', [DataLaporanController::class, 'store_status_hamil'])->middleware('auth');

Route::get('/data_pasien/{id}/laporan_ibu_hamil', [DataLaporanController::class, 'preview_status_ibu_hamil'])->middleware('auth');
Route::patch('/edit_biodata/{id}/edit/laporan_ibu_hamil', [DataLaporanController::class, 'update_ibu_hamilv2'])->middleware('auth');
Route::post('/status_periksa_ibu_hamil/{id}/create', [DataLaporanController::class, 'store_status_periksa_hamil'])->middleware('auth');
Route::delete('/status_ibu_hamil/{id}/delete', [DataLaporanController::class, 'destroy_status_ibu_hamil'])->middleware('auth');
Route::get('/data_pasien/laporan_ibu_hamil/{id}', [DataLaporanController::class, 'edit_status_hamil'])->middleware('auth');
Route::patch('/status_periksa_ibu_hamil/{id}/update', [DataLaporanController::class, 'update_status_periksa_hamil'])->middleware('auth');
Route::patch('/tambah_nama_balita/{id}/create', [DataLaporanController::class, 'update_nama_balita'])->middleware('auth');

Route::get('/data_pasien/{id}/laporan_data_balita', [DataLaporanController::class, 'preview_laporan_data_balita'])->middleware('auth');
Route::patch('/edit_biodata/{id}/edit/data_ibu_hamil/data_balita', [DataLaporanController::class, 'update_ibu_hamilv3'])->middleware('auth');
Route::patch('/edit_biodata/{id}/edit/data_balita', [DataLaporanController::class, 'update_biodata_balita'])->middleware('auth');
Route::post('/status_periksa_data_balita/{id}/create', [DataLaporanController::class, 'store_status_periksa_balita'])->middleware('auth');
Route::get('/status_periksa_balita/{id}/edit', [DataLaporanController::class, 'edit_status_periksa_balita'])->middleware('auth');
Route::patch('/status_periksa_balita/{id}/update', [DataLaporanController::class, 'update_status_periksa_balita'])->middleware('auth');
Route::delete('/status_periksa_balita/delete/{id}', [DataLaporanController::class, 'destroy_status_periksa_balita'])->middleware('auth');
Route::get('/cetak/hasil_pemeriksaan/{id}', [DataLaporanController::class, 'cetak'])->middleware('auth');

Route::get('/user/admin', [UserController::class, 'index_admin'])->middleware('auth');
Route::get('/user/admin/tambah', [UserController::class, 'create_admin'])->middleware('auth');
Route::post('/tambah_user/admin', [UserController::class, 'store_admin'])->middleware('auth');
Route::get('/edit_user/edit/{id}', [UserController::class, 'edit_admin'])->middleware('auth');
Route::patch('/edit_user/update/{id}', [UserController::class, 'update_admin'])->middleware('auth');
Route::delete('/hapus/{id}/admin', [UserController::class, 'destroy_admin'])->middleware('auth');

Route::get('/user/bidan', [UserController::class, 'index_bidan'])->middleware('auth');
Route::get('/user/bidan/tambah', [UserController::class, 'create_bidan'])->middleware('auth');
Route::post('/tambah_user/bidan', [UserController::class, 'store_bidan'])->middleware('auth');
Route::get('/edit_bidan/edit/{id}', [UserController::class, 'edit_bidan'])->middleware('auth');
Route::patch('/edit_bidan/update/{id}', [UserController::class, 'update_bidan'])->middleware('auth');
Route::delete('/hapus/{id}/bidan', [UserController::class, 'destroy_bidan'])->middleware('auth');

Route::get('/data_obat', [DataVaksinController::class, 'index'])->middleware('auth');
Route::get('/data_obat/tambah', [DataVaksinController::class, 'create'])->middleware('auth');
Route::post('/data_obat/tambah/create', [DataVaksinController::class, 'store'])->middleware('auth');
Route::get('/data_obat/edit/{id}', [DataVaksinController::class, 'edit'])->middleware('auth');
Route::patch('/data_obat/update/{id}', [DataVaksinController::class, 'update'])->middleware('auth');
Route::delete('/data_obat/{id}/delete', [DataVaksinController::class, 'destroy'])->middleware('auth');
