<?php

namespace PluginsNameSpaces\Http\Requests;

use PluginsNameSpaces\Framework\Foundation\RequestGuard;

/**
 * Form request validating the payload for creating/updating an Example.
 *
 * Throws ValidationException (→ 422) on failure; the Router converts it
 * into a JSON error response automatically.
 */
class ExampleRequest extends RequestGuard
{
    /**
     * Validation rules.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title'  => 'required|string|max:191',
            'status' => 'nullable|in:active,inactive',
        ];
    }

    /**
     * Custom error messages.
     *
     * @return array
     */
    public function messages()
    {
        return [
            'title.required' => __('A title is required.', '__PLUGIN_NAME__'),
        ];
    }
}
