<?php

use App\Http\Controllers\Admin\SystemBackupController;
use Illuminate\Support\Facades\Route;

Route::middleware(['auth', 'permission:system.settings.manage'])
    ->prefix('admin')
    ->name('admin.')
    ->group(function (): void {
        Route::get('/system-backups', [SystemBackupController::class, 'index'])->name('system-backups.index');
        Route::post('/system-backups', [SystemBackupController::class, 'store'])->name('system-backups.store');
        Route::post('/system-backups/prune', [SystemBackupController::class, 'prune'])->name('system-backups.prune');
        Route::get('/system-backups/{filename}/download', [SystemBackupController::class, 'download'])
            ->where('filename', '[A-Za-z0-9._-]+')
            ->name('system-backups.download');
        Route::delete('/system-backups/{filename}', [SystemBackupController::class, 'destroy'])
            ->where('filename', '[A-Za-z0-9._-]+')
            ->name('system-backups.destroy');
    });
