<?php

namespace App\Http\Requests;

use App\Libs\Support\Sanitizer\Traits\SanitizesInput;
use Illuminate\Foundation\Http\FormRequest;

class ConfigurationStore extends FormRequest
{
    use SanitizesInput;

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

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {

        //TODO - check the model item that is being saved for rules
        $rules = [
            'value' => 'sometimes|max:2048'
        ];


        return $rules;
    }

    /**
     * Get the error messages for the defined validation rules.
     *
     * @return array
     */
    public function messages(): array
    {
        return [];
    }

    /**
     * Filters to be applied to the input.
     *
     * @return array
     */
    public function filters(): array
    {
        return [
            'value' => "trim|strip_tags|xss_clean",
        ];
    }
}
