<?php

use Illuminate\Support\Facades\Route;

//Auth
Route::get('/login', [App\Http\Controllers\AuthController::class, 'login'])->name('login');
Route::get('/register', [App\Http\Controllers\AuthController::class, 'register'])->name('register');
Route::post('/create-account', [App\Http\Controllers\AuthController::class, 'createAccount'])->name('auth.createAccount');
Route::patch('/users/{user}/verify', [App\Http\Controllers\AuthController::class, 'verify'])->name('users.verify');
Route::post('/authenticate', [App\Http\Controllers\AuthController::class, 'authenticate'])->name('auth.authenticate');
Route::post('/logout', [App\Http\Controllers\AuthController::class, 'logout'])->name('logout');
Route::get('/roles', [App\Http\Controllers\UserRoleController::class, 'index'])->name('roles.index');
Route::post('/roles', [App\Http\Controllers\UserRoleController::class, 'store'])->name('roles.store');
Route::delete('/roles/{role}', [App\Http\Controllers\UserRoleController::class, 'destroy'])->name('roles.destroy');

Route::middleware('auth')
    ->group(function () {

    // Home
    Route::get('/', [App\Http\Controllers\Web\SummaryDashboardController::class, 'index'])->name('dashboard.summary');
    Route::get('/resiliensi', [App\Http\Controllers\Web\ResiliensiDashboardController::class, 'index'])->name('dashboard.resiliensi');
    Route::get('/hilirisasi', [App\Http\Controllers\Web\HilirisasiDashboardController::class, 'index'])->name('dashboard.hilirisasi');
    Route::get('/konektivitas', [App\Http\Controllers\Web\KonektivitasDashboardController::class, 'index'])->name('dashboard.konektivitas');
    Route::get('/akselerasi', [App\Http\Controllers\Web\AkselerasiDashboardController::class, 'index'])->name('dashboard.akselerasi');

    // User
    Route::get('/users', [App\Http\Controllers\UserController::class, 'index'])->name('users.index');
    Route::get('/api/users-list', [App\Http\Controllers\UserController::class, 'getUsers'])->name('api.users.list');
    // });

    // Provinsi
    Route::get('/provinsi', [App\Http\Controllers\ProvinsiController::class, 'index'])->name('provinsi.index');
    Route::get('/getprovinsi', [App\Http\Controllers\ProvinsiController::class, 'getProvinsi'])->name('provinsi.list');

    // Kabupaten
    Route::get('/kabupatenkota', [App\Http\Controllers\KabupatenKotaController::class, 'index'])->name('kabupatenkota.index');
    Route::get('/getkabupatenkota', [App\Http\Controllers\KabupatenKotaController::class, 'getKabupatenKota'])->name('kabupatenkota.list');

    // Kecamatan
    Route::get('/kecamatan', [App\Http\Controllers\KecamatanController::class, 'index'])->name('kecamatan.index');
    Route::get('/getkecamatan', [App\Http\Controllers\KecamatanController::class, 'getKecamatan'])->name('kecamatan.list');

    // Kelurahan
    Route::get('/desakelurahan', [App\Http\Controllers\DesaKelurahanController::class, 'index'])->name('desakelurahan.index');
    Route::get('/getdesakelurahan', [App\Http\Controllers\DesaKelurahanController::class, 'getDesaKelurahan'])->name('desakelurahan.list');
});