<?php

namespace App\Modules\HR\Recruitment\Requests;

use App\Modules\HR\Recruitment\Models\RecruitmentJobRequest;
use Illuminate\Foundation\Http\FormRequest;

class RejectJobRequestRequest extends FormRequest
{
    public function authorize(): bool
    {
        $row = $this->route('job_request');

        return $row instanceof RecruitmentJobRequest
            && ($this->user()?->can('approve', $row) ?? false);
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'review_notes' => ['nullable', 'string', 'max:2000'],
        ];
    }
}
