<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ResendInvitationRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'portal_user_id' => ['required', 'integer', 'exists:portal_users,id'],
        ];
    }

    /**
     * Get custom messages for validator errors.
     *
     * @return array<string, string>
     */
    public function messages(): array
    {
        return [
            'portal_user_id.required' => 'The portal user ID is required.',
            'portal_user_id.integer' => 'The portal user ID must be an integer.',
            'portal_user_id.exists' => 'The specified portal user does not exist.',
        ];
    }
}
