<?php

use App\Http\Controllers\Api\NotificationController;
use App\Http\Controllers\Api\PresignedUrlController;
use App\Http\Controllers\Api\PushSubscriptionController;
use Illuminate\Support\Facades\Route;

Route::post('/presigned-url', [PresignedUrlController::class, 'store'])
    ->middleware(['web', 'auth', 'verified'])
    ->name('presigned-url.store');

Route::get('/presigned-url/{key}', [PresignedUrlController::class, 'show'])
    ->middleware(['web', 'auth', 'verified'])
    ->name('presigned-url.show')
    ->where('key', '.*');

Route::post('/push/subscribe', [PushSubscriptionController::class, 'store'])
    ->middleware(['web', 'auth', 'verified'])
    ->name('push.subscribe');

Route::delete('/push/unsubscribe', [PushSubscriptionController::class, 'destroy'])
    ->middleware(['web', 'auth', 'verified'])
    ->name('push.unsubscribe');

Route::get('/notifications', [NotificationController::class, 'index'])
    ->middleware(['web', 'auth', 'verified'])
    ->name('notifications.index');

Route::get('/notifications/unread-count', [NotificationController::class, 'unreadCount'])
    ->middleware(['web', 'auth', 'verified'])
    ->name('notifications.unread-count');

Route::patch('/notifications/{notification}/read', [NotificationController::class, 'markAsRead'])
    ->middleware(['web', 'auth', 'verified'])
    ->name('notifications.mark-as-read');

Route::delete('/notifications/{notification}', [NotificationController::class, 'destroy'])
    ->middleware(['web', 'auth', 'verified'])
    ->name('notifications.destroy');

Route::patch('/notifications/read-all', [NotificationController::class, 'markAllAsRead'])
    ->middleware(['web', 'auth', 'verified'])
    ->name('notifications.mark-all-as-read');
