<?php

use Illuminate\Support\Facades\Route;
use App\Http\Middleware\Session;
use App\Http\Controllers\FrontController;
use App\Http\Controllers\Auth\CustomLoginController;
use App\Http\Controllers\Auth\CustomRegisterController;
use App\Http\Controllers\AjaxController;
use App\Http\Controllers\Opendata\DatasetController;
use App\Http\Controllers\BeritaController;

/*
|--------------------------------------------------------------------------
| 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('/test', function(){
    return view('dashboardtest');
});

//berita
Route::resource('/berita', BeritaController::class);
Route::post('/berita', [BeritaController::class,'store']);





Route::get('/', [FrontController::class,'index'])->name('index');

Route::get('/resource-data', [FrontController::class,'resource'])->name('resource');
Route::get('/berita', [FrontController::class,'berita'])->name('berita');
Route::get('/publikasi', [FrontController::class,'publikasi'])->name('publikasi');
Route::get('/berita-detail', [FrontController::class,'beritaDetail'])->name('beritaDetail');
Route::get('/dataset', [FrontController::class,'dataset'])->name('dataset');
Route::get('/dataset/detail/{id}', [FrontController::class,'dataset_detail'])->name('dataset_detail');
Route::get('/dataset/Griddetail', [FrontController::class,'Griddetail'])->name('Griddetail');
Route::get('/dataset/Griddetail2025', [FrontController::class,'Griddetail2025'])->name('Griddetail2025');
Route::get('/dataset-tambahan', [FrontController::class,'datasetTambahan'])->name('datasetTambahan');
Route::get('/dataset-tambahan/detail/{id}', [FrontController::class,'datasetTambahan_detail'])->name('datasetTambahan');
Route::get('/search', [FrontController::class,'search'])->name('search');
Route::get('/login', [CustomLoginController::class,'index'])->name('login');
Route::post('login',[CustomLoginController::class,'post_login'])->name('post_login');
Route::get('register',[CustomRegisterController::class,'index'])->name('register');
Route::post('register',[CustomRegisterController::class,'post_register'])->name('post_register');
Route::get('opendata/dataset/download/{id?}',[DatasetController::class,'download'])->name('download');

Route::get('getInstansi/{type}',[AjaxController::class,'getInstansi'])->name('getInstansi');

Route::middleware(Session::class)->name('modules.')->group(function () {

    include_route_files(__DIR__ . '/modules');

    Route::get('logout',[CustomLoginController::class,'logout'])->name('logout');
});

// Auth::routes();
// Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
