<?php

use App\Http\Controllers\Admin\DashboardController;
use App\Http\Controllers\Admin\OrganizationController;
use App\Http\Controllers\Admin\PlaceholderController;
use App\Http\Controllers\Admin\RoleController;
use App\Http\Controllers\Admin\TeamController;
use App\Http\Controllers\Admin\UserController;
use Illuminate\Support\Facades\Route;

Route::prefix('admin')->name('admin.')->middleware(['auth', 'admin', 'permission.team', 'panel.route'])->group(function () {
    Route::redirect('/', '/admin/dashboard');
    Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');

    Route::get('/team', [TeamController::class, 'index'])->name('team.index');
    Route::post('/team', [TeamController::class, 'store'])->name('team.store');
    Route::patch('/team/{user}/deactivate', [TeamController::class, 'deactivate'])->name('team.deactivate');

    Route::get('/users', [UserController::class, 'index'])->name('users.index');
    Route::post('/users', [UserController::class, 'store'])->name('users.store');
    Route::patch('/users/{user}/deactivate', [UserController::class, 'deactivate'])->name('users.deactivate');

    Route::get('/organizations', [OrganizationController::class, 'index'])->name('organizations.index');
    Route::get('/organizations/create', [OrganizationController::class, 'create'])->name('organizations.create');
    Route::post('/organizations', [OrganizationController::class, 'store'])->name('organizations.store');
    Route::get('/grupos-mariachi', [OrganizationController::class, 'index'])->name('mariachi-groups.index');
    Route::get('/grupos-mariachi/crear', [OrganizationController::class, 'create'])->name('mariachi-groups.create');
    Route::post('/grupos-mariachi', [OrganizationController::class, 'store'])->name('mariachi-groups.store');
    Route::put('/grupos-mariachi/{organization}', [OrganizationController::class, 'update'])->name('mariachi-groups.update');
    Route::patch('/grupos-mariachi/{organization}/desactivar', [OrganizationController::class, 'deactivate'])->name('mariachi-groups.deactivate');
    Route::post('/grupos-mariachi/{organization}/fusionar', [OrganizationController::class, 'merge'])->name('mariachi-groups.merge');
    Route::delete('/grupos-mariachi/{organization}', [OrganizationController::class, 'destroy'])->name('mariachi-groups.destroy');
    Route::get('/roles', [RoleController::class, 'index'])->name('roles.index');
    Route::post('/roles', [RoleController::class, 'store'])->name('roles.store');
    Route::put('/roles/{staffRole}', [RoleController::class, 'update'])->name('roles.update');
    Route::delete('/roles/{staffRole}', [RoleController::class, 'destroy'])->name('roles.destroy');

    Route::get('/clients', [PlaceholderController::class, 'clients'])->name('clients.index');
    Route::get('/reservations', [PlaceholderController::class, 'reservations'])->name('reservations.index');
    Route::get('/groups', [PlaceholderController::class, 'groups'])->name('groups.index');
    Route::get('/catalogs', [PlaceholderController::class, 'catalogs'])->name('catalogs.index');
});
