<?php

namespace App\Http\Requests\Member;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'rating'             => ['required', 'integer', 'min:1', 'max:5'],
            'comment'            => ['nullable', 'string', 'min:10', 'max:500'],
            'posted_as_nickname' => ['boolean'],
        ];
    }

    public function messages(): array
    {
        return [
            'rating.required' => __('freelance.validation.rating_required'),
            'rating.min'      => __('freelance.validation.rating_range'),
            'rating.max'      => __('freelance.validation.rating_range'),
            'comment.min'     => __('freelance.validation.comment_min'),
        ];
    }
}
