<?php

namespace App\Modules\HR\Contracts\Requests;

use App\Modules\HR\Contracts\Models\EmploymentContract;

class UpdateEmploymentContractRequest extends StoreEmploymentContractRequest
{
    public function authorize(): bool
    {
        /** @var EmploymentContract|null $contract */
        $contract = $this->route('employment_contract');

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