<?php

use App\Http\Controllers\NotificationCenterController;
use App\Http\Controllers\NotificationSettingsController;
use App\Http\Controllers\ReminderNotificationController;
use Illuminate\Support\Facades\Route;

Route::middleware('auth')->group(function (): void {
    Route::get('/notification-center',[NotificationCenterController::class,'index'])->name('notification-center.index');
    Route::post('/notification-center/read-all',[NotificationCenterController::class,'readAll'])->name('notification-center.read-all');
    Route::post('/notification-center/{notification}/read',[NotificationCenterController::class,'read'])->name('notification-center.read');
    Route::post('/notification-center/{notification}/open',[NotificationCenterController::class,'open'])->name('notification-center.open');
    Route::delete('/notification-center/{notification}',[NotificationCenterController::class,'destroy'])->name('notification-center.destroy');

    Route::get('/notifications',[ReminderNotificationController::class,'index'])->middleware('permission:notifications.view')->name('notifications.index');
    Route::post('/notifications/{notification}/retry',[ReminderNotificationController::class,'retry'])->middleware(['permission:notifications.retry','can:retry,notification'])->name('notifications.retry');
    Route::get('/notification-settings',[NotificationSettingsController::class,'edit'])->middleware('permission:notifications.manage')->name('notification-settings.edit');
    Route::put('/notification-settings',[NotificationSettingsController::class,'update'])->middleware('permission:notifications.manage')->name('notification-settings.update');
    Route::put('/notification-templates/{template}',[NotificationSettingsController::class,'updateTemplate'])->middleware('permission:notifications.manage')->name('notification-templates.update');
});
