<?php

use App\Modules\HR\Contracts\Controllers\EmploymentContractsPageController;
use Illuminate\Support\Facades\Route;

Route::prefix('hr/contracts')
    ->name('hr.contracts.')
    ->middleware('module:hr')
    ->group(function () {
        Route::get('/', [EmploymentContractsPageController::class, 'index'])
            ->middleware('can:contracts.view')
            ->name('index');
        Route::get('/create', [EmploymentContractsPageController::class, 'create'])
            ->middleware('can:contracts.create')
            ->name('create');
        Route::post('/', [EmploymentContractsPageController::class, 'store'])
            ->middleware('can:contracts.create')
            ->name('store');
        Route::get('/{employment_contract}/edit', [EmploymentContractsPageController::class, 'edit'])
            ->middleware('can:contracts.update,employment_contract')
            ->name('edit');
        Route::put('/{employment_contract}', [EmploymentContractsPageController::class, 'update'])
            ->middleware('can:contracts.update,employment_contract')
            ->name('update');
        Route::post('/{employment_contract}/deactivate', [EmploymentContractsPageController::class, 'deactivate'])
            ->middleware('can:contracts.deactivate,employment_contract')
            ->name('deactivate');
    });
