<?php

use App\Modules\HR\Departments\Controllers\DepartmentController;
use Illuminate\Support\Facades\Route;

Route::prefix('api/hr/departments')->name('api.hr.departments.')->group(function () {
    Route::get('/', [DepartmentController::class, 'index'])
        ->middleware('can:departments.view')
        ->name('index');

    Route::post('/', [DepartmentController::class, 'store'])
        ->middleware('can:departments.create')
        ->name('store');

    Route::put('/{department}', [DepartmentController::class, 'update'])
        ->middleware('can:departments.update,department')
        ->name('update');

    Route::delete('/{department}', [DepartmentController::class, 'destroy'])
        ->middleware('can:departments.delete,department')
        ->name('destroy');

    Route::post('/bulk-destroy', [DepartmentController::class, 'bulkDestroy'])
        ->middleware('can:departments.delete')
        ->name('bulk-destroy');
});
