<?php

use App\Http\Controllers\API\AuthController;
use App\Http\Controllers\API\KategoriController;
use App\Http\Controllers\API\WisataController;
use Illuminate\Support\Facades\Route;

Route::get('/health', fn () => response()->json([
    'success' => true,
    'message' => 'Success',
    'data' => [
        'service' => 'Explore Lumajang API',
        'timestamp' => now()->toISOString(),
    ],
]));

Route::post('/register', [AuthController::class, 'register']);
Route::post('/login', [AuthController::class, 'login']);
Route::post('/forgot-password', [AuthController::class, 'forgotPassword']);
Route::post('/reset-password', [AuthController::class, 'resetPassword']);
Route::get('/kategori', [KategoriController::class, 'index']);
Route::get('/destinations', [WisataController::class, 'index']);
Route::get('/destinations/{wisata}', [WisataController::class, 'show']);
Route::get('/wisata', [WisataController::class, 'index']);
Route::get('/wisata/{wisata}', [WisataController::class, 'show']);

Route::middleware('api.token')->group(function (): void {
    Route::get('/profile', [AuthController::class, 'profile']);
    Route::post('/logout', [AuthController::class, 'logout']);
    Route::post('/wisata/{wisata}/gambar', [WisataController::class, 'uploadImage']);
});
