<?php

/**
 * prefix admin/json-objects
 * as admin.jsonObjects.
 */

use Illuminate\Support\Facades\Route;
use Src\Modules\JsonObjects\Laravel\Controllers\DirController;
use Src\Modules\JsonObjects\Laravel\Controllers\ItemController;
use Src\Modules\JsonObjects\Laravel\Controllers\FilesBrowserController;

Route::group(['prefix' => 'admin/json-objects', 'as' => 'admin.jsonObjects.'], function(){
    Route::get('/dir', [DirController::class, 'dir'])->name('dir');
    Route::post('/new-dir', [DirController::class, 'newDir'])->name('newDir');
    Route::post('/rename-dir', [DirController::class, 'renameDir'])->name('renameDir');
    Route::post('/delete-dir', [DirController::class, 'deleteDir'])->name('deleteDir');

    Route::get('/item', [ItemController::class, 'item'])->name('item');
    Route::post('/edit-item', [ItemController::class, 'editItem'])->name('editItem');
    Route::post('/new-item', [ItemController::class, 'newItem'])->name('newItem');
    Route::post('/rename-item', [ItemController::class, 'renameItem'])->name('renameItem');
    Route::post('/delete-item', [ItemController::class, 'deleteItem'])->name('deleteItem');

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