<?php

use Illuminate\Support\Facades\Route;

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

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

    // Home
    Route::get('/', [App\Http\Controllers\Web\Dashboard\SummaryController::class, 'index'])->name('dashboard.summary');
    Route::get('/resiliensi', [App\Http\Controllers\Web\Dashboard\ResiliensiController::class, 'index'])->name('dashboard.resiliensi');
    Route::get('/hilirisasi', [App\Http\Controllers\Web\Dashboard\HilirisasiController::class, 'index'])->name('dashboard.hilirisasi');
    Route::get('/konektivitas', [App\Http\Controllers\Web\Dashboard\KonektivitasController::class, 'index'])->name('dashboard.konektivitas');
    Route::get('/akselerasi', [App\Http\Controllers\Web\Dashboard\AkselerasiController::class, 'index'])->name('dashboard.akselerasi');

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

    // Provinsi
    Route::get('/provinsi', [App\Http\Controllers\Web\Master\ProvinsiController::class, 'index'])->name('provinsi.index');
    Route::post('/provinsi', [App\Http\Controllers\Web\Master\ProvinsiController::class, 'store'])->name('provinsi.store');
    Route::get('/provinsi/{id}', [App\Http\Controllers\Web\Master\ProvinsiController::class, 'view'])->name('provinsi.view');
    Route::put('/provinsi/{id}', [App\Http\Controllers\Web\Master\ProvinsiController::class, 'update'])->name('provinsi.update');
    Route::delete('/provinsi/{id}', [App\Http\Controllers\Web\Master\ProvinsiController::class, 'destroy'])->name('provinsi.destroy');

    // Kabupaten
    Route::get('/kabupatenkota', [App\Http\Controllers\Web\Master\KabupatenKotaController::class, 'index'])->name('kabupatenkota.index');
    Route::get('/kabupatenkotabyprovinsi/{provinsi_id}', [App\Http\Controllers\Web\Master\KabupatenKotaController::class, 'getByProvinsi'])->name('kabupatenkota.byprovinsi');
    Route::post('/kabupatenkota', [App\Http\Controllers\Web\Master\KabupatenKotaController::class, 'store'])->name('kabupatenkota.store');
    Route::get('/kabupatenkota/{id}', [App\Http\Controllers\Web\Master\KabupatenKotaController::class, 'view'])->name('kabupatenkota.view');
    Route::put('/kabupatenkota/{id}', [App\Http\Controllers\Web\Master\KabupatenKotaController::class, 'update'])->name('kabupatenkota.update');
    Route::delete('/kabupatenkota/{id}', [App\Http\Controllers\Web\Master\KabupatenKotaController::class, 'destroy'])->name('kabupatenkota.destroy');

    // Kecamatan
    Route::get('/kecamatan', [App\Http\Controllers\Web\Master\KecamatanController::class, 'index'])->name('kecamatan.index');
    Route::get('/kecamatanbykabupatenkota/{kabupaten_id}', [App\Http\Controllers\Web\Master\KecamatanController::class, 'getByKabupaten'])->name('kecamatan.bykabupatenkota');
    Route::post('/kecamatan', [App\Http\Controllers\Web\Master\KecamatanController::class, 'store'])->name('kecamatan.store');
    Route::get('/kecamatan/{id}', [App\Http\Controllers\Web\Master\KecamatanController::class, 'view'])->name('kecamatan.view');
    Route::put('/kecamatan/{id}', [App\Http\Controllers\Web\Master\KecamatanController::class, 'update'])->name('kecamatan.update');
    Route::delete('/kecamatan/{id}', [App\Http\Controllers\Web\Master\KecamatanController::class, 'destroy'])->name('kecamatan.destroy');

    // Kelurahan
    Route::get('/desakelurahan', [App\Http\Controllers\Web\Master\DesaKelurahanController::class, 'index'])->name('desakelurahan.index');
    Route::get('/desakelurahanbykecamatan/{kecamatan_id}', [App\Http\Controllers\Web\Master\DesaKelurahanController::class, 'getByKecamatan'])->name('desakelurahan.bykecamatan');
    Route::post('/desakelurahan', [App\Http\Controllers\Web\Master\DesaKelurahanController::class, 'store'])->name('desakelurahan.store');
    Route::get('/desakelurahan/{id}', [App\Http\Controllers\Web\Master\DesaKelurahanController::class, 'view'])->name('desakelurahan.view');
    Route::put('/desakelurahan/{id}', [App\Http\Controllers\Web\Master\DesaKelurahanController::class, 'update'])->name('desakelurahan.update');
    Route::delete('/desakelurahan/{id}', [App\Http\Controllers\Web\Master\DesaKelurahanController::class, 'destroy'])->name('desakelurahan.destroy');

    // Adat
    Route::get('/adat', [App\Http\Controllers\Web\Master\AdatController::class, 'index'])->name('adat.index');
    Route::get('/adatbydesakelurahan/{adat_id}', [App\Http\Controllers\Web\Master\AdatController::class, 'getByDesaKelurahan'])->name('desakelurahan.bydesakelurahan');
    Route::post('/adat', [App\Http\Controllers\Web\Master\AdatController::class, 'store'])->name('adat.store');
    Route::get('/adat/{id}', [App\Http\Controllers\Web\Master\AdatController::class, 'show'])->name('adat.view');
    Route::put('/adat/{id}', [App\Http\Controllers\Web\Master\AdatController::class, 'update'])->name('adat.update');
    Route::delete('/adat/{id}', [App\Http\Controllers\Web\Master\AdatController::class, 'destroy'])->name('adat.destroy');

    // Users
    Route::get('/users', [App\Http\Controllers\Web\Konfigurasi\UserController::class, 'index'])->name('users.index');
    Route::post('/users', [App\Http\Controllers\Web\Konfigurasi\UserController::class, 'store'])->name('users.store');
    Route::get('/users/{id}', [App\Http\Controllers\Web\Konfigurasi\UserController::class, 'show'])->name('users.view');
    Route::put('/users/{id}', [App\Http\Controllers\Web\Konfigurasi\UserController::class, 'update'])->name('users.update');
    Route::delete('/users/{id}', [App\Http\Controllers\Web\Konfigurasi\UserController::class, 'destroy'])->name('users.destroy');
    
    // Profil
    Route::get('/profile', [App\Http\Controllers\Web\Ekosistem\ProfileController::class, 'index'])->name('profile.index');
    Route::get('/profile/add', [App\Http\Controllers\Web\Ekosistem\ProfileController::class, 'create'])->name('profile.create');
    Route::post('/profile', [App\Http\Controllers\Web\Ekosistem\ProfileController::class, 'store'])->name('profile.store');
    Route::get('/profile/{id}', [App\Http\Controllers\Web\Ekosistem\ProfileController::class, 'show'])->name('profile.show');
    Route::get('/profile/edit/{id}', [App\Http\Controllers\Web\Ekosistem\ProfileController::class, 'edit'])->name('profile.edit');
    Route::put('/profile/{id}', [App\Http\Controllers\Web\Ekosistem\ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile/{id}', [App\Http\Controllers\Web\Ekosistem\ProfileController::class, 'destroy'])->name('profile.destroy');

    Route::get('/lahan', [App\Http\Controllers\Web\Ekosistem\LahanController::class, 'index'])->name('lahan.index');
    Route::get('/lahan/add', [App\Http\Controllers\Web\Ekosistem\LahanController::class, 'create'])->name('lahan.create');
    Route::post('/lahan', [App\Http\Controllers\Web\Ekosistem\LahanController::class, 'store'])->name('lahan.store');
    Route::get('/lahan/edit/{id}', [App\Http\Controllers\Web\Ekosistem\LahanController::class, 'edit'])->name('lahan.edit');
    Route::put('/lahan/{id}', [App\Http\Controllers\Web\Ekosistem\LahanController::class, 'update'])->name('lahan.update');
    Route::delete('/lahan/{id}', [App\Http\Controllers\Web\Ekosistem\LahanController::class, 'destroy'])->name('lahan.destroy');
    Route::get('/lahan/{id}', [App\Http\Controllers\Web\Ekosistem\LahanController::class, 'show'])->name('lahan.show');

    Route::get('/komoditas', [App\Http\Controllers\Web\Ekosistem\KomoditasController::class, 'index'])->name('komoditas.index');
    Route::post('/komoditas', [App\Http\Controllers\Web\Ekosistem\KomoditasController::class, 'store'])->name('komoditas.store');
    Route::get('/komoditas/{id}', [App\Http\Controllers\Web\Ekosistem\KomoditasController::class, 'show'])->name('komoditas.show');
    Route::put('/komoditas/{id}', [App\Http\Controllers\Web\Ekosistem\KomoditasController::class, 'update'])->name('komoditas.update');
    Route::delete('/komoditas/{id}', [App\Http\Controllers\Web\Ekosistem\KomoditasController::class, 'destroy'])->name('komoditas.destroy');

    Route::get('/keluarga', [App\Http\Controllers\Web\Ekosistem\KeluargaController::class, 'index'])->name('keluarga.index');
    Route::get('/keluarga/add', [App\Http\Controllers\Web\Ekosistem\KeluargaController::class, 'create'])->name('keluarga.create');
    Route::post('/keluarga', [App\Http\Controllers\Web\Ekosistem\KeluargaController::class, 'store'])->name('keluarga.store');
    Route::get('/keluarga/edit/{id}', [App\Http\Controllers\Web\Ekosistem\KeluargaController::class, 'edit'])->name('keluarga.edit');
    Route::put('/keluarga/{id}', [App\Http\Controllers\Web\Ekosistem\KeluargaController::class, 'update'])->name('keluarga.update');
    Route::delete('/keluarga/{id}', [App\Http\Controllers\Web\Ekosistem\KeluargaController::class, 'destroy'])->name('keluarga.destroy');
    Route::get('/keluarga/{id}', [App\Http\Controllers\Web\Ekosistem\KeluargaController::class, 'show'])->name('keluarga.show');

    Route::get('/tanaman', [App\Http\Controllers\Web\Ekosistem\TanamanController::class, 'index'])->name('tanaman.index');
    Route::get('/tanaman/add', [App\Http\Controllers\Web\Ekosistem\TanamanController::class, 'create'])->name('tanaman.create');
    Route::post('/tanaman', [App\Http\Controllers\Web\Ekosistem\TanamanController::class, 'store'])->name('tanaman.store');
    Route::get('/tanaman/get-lahan/{id}', [App\Http\Controllers\Web\Ekosistem\TanamanController::class, 'getLahan'])->name('tanaman.get-lahan');
    Route::get('/tanaman/edit/{id}', [App\Http\Controllers\Web\Ekosistem\TanamanController::class, 'edit'])->name('tanaman.edit');
    Route::put('/tanaman/{id}', [App\Http\Controllers\Web\Ekosistem\TanamanController::class, 'update'])->name('tanaman.update');
    Route::delete('/tanaman/{id}', [App\Http\Controllers\Web\Ekosistem\TanamanController::class, 'destroy'])->name('tanaman.destroy');
    Route::get('/tanaman/{id}', [App\Http\Controllers\Web\Ekosistem\TanamanController::class, 'show'])->name('tanaman.show');
});