<?php

namespace App\Modules\HR\Contracts\Requests;

use App\Modules\HR\Contracts\Models\EmploymentContract;
use Illuminate\Foundation\Http\FormRequest;

class TerminateContractRequest extends FormRequest
{
    public function authorize(): bool
    {
        $contract = $this->route('employment_contract');

        return $contract instanceof EmploymentContract
            && ($this->user()?->can('deactivate', $contract) ?? false);
    }

    public function rules(): array
    {
        return ['termination_reason' => ['nullable', 'string', 'max:5000']];
    }
}
