<?php

use App\Modules\HR\Positions\Controllers\PositionPageController;
use Illuminate\Support\Facades\Route;

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

    Route::get('/create', [PositionPageController::class, 'create'])
        ->middleware('can:positions.create')
        ->name('create');

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

    Route::get('/{position}/edit', [PositionPageController::class, 'edit'])
        ->middleware('can:positions.update,position')
        ->name('edit');

    Route::put('/{position}', [PositionPageController::class, 'update'])
        ->middleware('can:positions.update,position')
        ->name('update');

    Route::post('/{position}/deactivate', [PositionPageController::class, 'deactivate'])
        ->middleware('can:positions.deactivate,position')
        ->name('deactivate');
});
