<?php

namespace App\Http\Requests\Messaging;

use Illuminate\Foundation\Http\FormRequest;

class StoreMessageRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user() !== null;
    }

    public function rules(): array
    {
        return [
            'body' => 'nullable|string|max:5000',
            'attachments' => 'sometimes|array|max:5',
            'attachments.*' => 'file|max:25600',
            'client_temp_id' => 'nullable|string|max:120',
            'reply_to_message_id' => 'nullable|integer|exists:messages,id',
        ];
    }
}
