<?php

use App\Modules\HR\Payroll\Controllers\SalaryStructurePageController;
use Illuminate\Support\Facades\Route;

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

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

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

        Route::get('/{salary_structure}/edit', [SalaryStructurePageController::class, 'edit'])
            ->middleware('can:salary_structures.update,salary_structure')
            ->name('edit');

        Route::put('/{salary_structure}', [SalaryStructurePageController::class, 'update'])
            ->middleware('can:salary_structures.update,salary_structure')
            ->name('update');

        Route::post('/{salary_structure}/deactivate', [SalaryStructurePageController::class, 'deactivate'])
            ->middleware('can:salary_structures.deactivate,salary_structure')
            ->name('deactivate');
    });
