<?php

use App\Http\Controllers\Frontend\Graphics\ClipartController;
use App\Http\Controllers\Frontend\Graphics\ShapesController;
use App\Http\Controllers\Frontend\Graphics\BackgroundImageController;

// All route names are prefixed with 'admin.auth'.
Route::group([
    'middleware' => 'role:'.config('access.users.admin_role'),
], function () {
    // Clipart Management
    Route::group(['namespace' => 'Clipart'], function () {

        // Clipart CRUD
        Route::get('clipart', [ClipartController::class, 'index'])->name('clipart.index');
        Route::get('clipart/create', [ClipartController::class, 'create'])->name('clipart.create');
        Route::post('clipart/store', [ClipartController::class, 'store'])->name('clipart.store');
        Route::post('clipart/bulkimport', [ClipartController::class, 'bulkImport'])->name('clipart.bulkimport');
        Route::post('clipart/delete', [ClipartController::class, 'delete'])->name('clipart.delete');
        // Specific clipart
        Route::group(['prefix' => 'clipart/{id}'], function () {
            Route::get('/', [ClipartController::class, 'show'])->name('clipart.show');
            Route::get('edit', [ClipartController::class, 'edit'])->name('clipart.edit');
            Route::patch('/', [ClipartController::class, 'update'])->name('clipart.update');
            Route::delete('/', [ClipartController::class, 'destroy'])->name('clipart.destroy');
        });
    });

    Route::group(['namespace' => 'Shapes'], function () {

        // Shapes views
        Route::get('shapes', [ShapesController::class, 'index'])->name('shapes.index');
       Route::get('shapes/create', [ShapesController::class, 'create'])->name('shapes.create');
        Route::post('shapes/store', [ShapesController::class, 'store'])->name('shapes.store');

        // Specific shapes
        Route::group(['prefix' => 'shapes/{id}'], function () {
            Route::get('/', [ShapesController::class, 'show'])->name('shapes.show');
            Route::get('edit', [ShapesController::class, 'edit'])->name('shapes.edit');
            Route::patch('/', [ShapesController::class, 'update'])->name('shapes.update');
            Route::delete('/', [ShapesController::class, 'destroy'])->name('shapes.destroy');
        });
    });
    Route::group(['namespace' => 'Backgrounds'], function () {

        // Shapes views
        Route::get('backgrounds', [BackgroundImageController::class, 'index'])->name('backgrounds.index');
        Route::get('backgrounds/create', [BackgroundImageController::class, 'create'])->name('backgrounds.create');
        Route::post('backgrounds/store', [BackgroundImageController::class, 'store'])->name('backgrounds.store');

        // Specific shapes
        Route::group(['prefix' => 'backgrounds/{id}'], function () {
            Route::get('', [BackgroundImageController::class, 'show'])->name('backgrounds.show');
            Route::get('edit', [BackgroundImageController::class, 'edit'])->name('backgrounds.edit');
            Route::patch('/', [BackgroundImageController::class, 'update'])->name('backgrounds.update');
            Route::delete('/', [BackgroundImageController::class, 'destroy'])->name('backgrounds.destroy');
        });
    });

});
