<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\LoginController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\DataController;
use App\Http\Controllers\KecamatanController;
use App\Http\Controllers\KMeansController;
use App\Http\Controllers\ExportController;

/*
|--------------------------------------------------------------------------
| 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('/', [LoginController::class, 'showLoginForm'])->name('login');
Route::post('/', [LoginController::class, 'login']);
Route::post('/logout', [LoginController::class, 'logout'])->name('logout');

Route::get('/data', [DataController::class, 'index'])->name('data.index');
Route::post('/upload-data', [DataController::class, 'import'])->name('upload.data');

Route::get('/kecamatan', [KecamatanController::class, 'index'])->name('kecamatan.index');
Route::post('/tambah-kecamatan', [KecamatanController::class, 'store'])->name('kecamatan.store');
Route::put('/kecamatan/{id}/edit', [KecamatanController::class, 'edit'])->name('kecamatan.edit');
Route::put('/kecamatan/{id}/update', [KecamatanController::class, 'update'])->name('kecamatan.update');


Route::get('/kmeans', [KMeansController::class, 'index'])->name('kmeans');
Route::get('/dashboard', [KMeansController::class, 'dashboard'])->name('dashboard.index');
Route::get('/export-clusters', [ExportController::class, 'exportClusters'])->name('export.clusters');
