<?php

use App\Http\Controllers\ApiKeyController;
use App\Http\Controllers\HiddenLinkController;
use App\Http\Controllers\IndexPageImageController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\SettingController;
use Illuminate\Support\Facades\Route;

// Route::get('/', fn () => view('landing.index'))->name('landing.index');
Route::get('/', [HiddenLinkController::class, 'showLinks'])->name('landing.index');
Route::get('/contact', fn () => view('landing.contact'))->name('landing.contact');

Route::middleware(['auth', 'verified'])->group(function () {
    Route::get('/dashboard', [HiddenLinkController::class, 'dashboard'])->name('dashboard');
    Route::get('/api-test', fn () => view('api-test'))->name('api-test');
    Route::get('/hidden-links', [HiddenLinkController::class, 'index'])->name('hidden-links.index');
    Route::post('/hidden-links', [HiddenLinkController::class, 'store'])->name('hidden-links.store');
    Route::post('/hidden-links/bulk', [HiddenLinkController::class, 'storeBulk'])->name('hidden-links.bulk-store');
    Route::delete('/hidden-links/{hiddenLink}', [HiddenLinkController::class, 'destroy'])->name('hidden-links.destroy');
    Route::delete('/hidden-links', [HiddenLinkController::class, 'destroyBulk'])->name('hidden-links.bulk-destroy');

    Route::get('/settings', [SettingController::class, 'edit'])->name('settings.edit');
    Route::put('/settings', [SettingController::class, 'update'])->name('settings.update');
    Route::post('/settings/index-page-images', [IndexPageImageController::class, 'store'])->name('index-page-images.store');
    Route::put('/settings/index-page-images/{indexPageImage}', [IndexPageImageController::class, 'update'])->name('index-page-images.update');
    Route::delete('/settings/index-page-images/{indexPageImage}', [IndexPageImageController::class, 'destroy'])->name('index-page-images.destroy');

    Route::post('/api-keys', [ApiKeyController::class, 'store'])->name('api-keys.store');
    Route::delete('/api-keys/{apiKey}', [ApiKeyController::class, 'destroy'])->name('api-keys.destroy');

    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
    Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});

require __DIR__.'/auth.php';
