<?php

namespace App\Http\Requests\Boards;

use Illuminate\Foundation\Http\FormRequest;

class CommentStoreRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'content' => 'required|string|max:2000',
            'parent_id' => 'nullable|integer|exists:board_comments,id',
        ];
    }

    public function messages(): array
    {
        return [
            'content.required' => __('validation.required', ['attribute' => '댓글 내용']),
            'content.max' => __('validation.max.string', ['attribute' => '댓글 내용', 'max' => 2000]),
        ];
    }
}
