<?php

use App\Http\Controllers\MediaUploadController;
use App\Http\Controllers\NotificationController;
use Illuminate\Support\Facades\Route;

Route::inertia('/', 'welcome')->name('home');

Route::middleware(['auth', 'verified'])->group(function () {
    Route::inertia('dashboard', 'dashboard')->name('dashboard');

    Route::prefix('notifications')->name('notifications.')->group(function () {
        Route::patch('mark-all-read', [NotificationController::class, 'markAllRead'])->name('mark-all-read');
        Route::delete('clear-all', [NotificationController::class, 'destroyAll'])->name('clear-all');
        Route::patch('{notification}/read', [NotificationController::class, 'markRead'])->name('read');
        Route::delete('{notification}', [NotificationController::class, 'destroy'])->name('destroy');
    });

    Route::prefix('media')->name('media.')->group(function () {
        Route::post('uploads', [MediaUploadController::class, 'store'])->name('uploads.store');
    });
});

Route::get('.well-known/passkey-endpoints', function () {
    return response()->json([
        'enroll' => route('admin.settings.security.edit'),
        'manage' => route('admin.settings.security.edit'),
    ]);
})->name('well-known.passkeys');

require __DIR__.'/admin.php';
