<?php

namespace App\Http\Requests\Api;

use Illuminate\Foundation\Http\FormRequest;

class ResourcesRequest extends FormRequest
{
    /**
     * Get Values From input
     *
     * @return array
     */
    public function validationData(): array
    {
        return [
            'page' => $this->input('page'),
            'perPage' => $this->input('perPage'),
            'cityId' => $this->input('cityId'),
            'type' => $this->input('type')
        ];
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'page' => 'nullable|integer',
            'perPage' => 'nullable|integer|max:300',
            'cityId' => 'nullable|integer',
            'type' => 'nullable|string',
        ];
    }

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