<?php

/**
 * prefix admin/common
 * as admin.common.
 */

use Illuminate\Support\Facades\Route;
use Src\Common\Laravel\Controllers\FilesBrowserControllers;
use Src\Common\Laravel\Controllers\JoditFilesBrowserController;

Route::group(['middleware' => ['web'], 'as' => 'admin.common.', 'prefix' => 'admin/common'], function () {
    Route::post('/dir/{dir}', [FilesBrowserControllers::class, 'dir'])->name('filesBrowser.dir');
    Route::post('/delete-file/{dir}', [FilesBrowserControllers::class, 'deleteFile'])->name('filesBrowser.deleteFile');
    Route::post('/rename-file/{dir}', [FilesBrowserControllers::class, 'renameFile'])->name('filesBrowser.renameFile');
    Route::post('/create-dir/{dir}', [FilesBrowserControllers::class, 'createDir'])->name('filesBrowser.createDir');
    Route::post('/upload-file/{dir}', [FilesBrowserControllers::class, 'uploadFile'])->name('filesBrowser.uploadFile');

    Route::group(['as' => 'filesBrowser.', 'prefix' => 'files-browser'], function () {
        Route::post('/upload', [JoditFilesBrowserController::class, 'upload'])->name('upload');
        Route::get('/create', [JoditFilesBrowserController::class, 'create'])->name('create');
        Route::post('/move', [JoditFilesBrowserController::class, 'move'])->name('move');
        Route::post('/remove', [JoditFilesBrowserController::class, 'remove'])->name('remove');
        Route::get('/items', [JoditFilesBrowserController::class, 'items'])->name('items');
        Route::post('/tree', [JoditFilesBrowserController::class, 'tree'])->name('tree');
        Route::get('/folder', [JoditFilesBrowserController::class, 'folder'])->name('folder');
        Route::post('/ajax', [JoditFilesBrowserController::class, 'ajax'])->name('ajax');
    });
});
