<?php

namespace App\Http\Requests;

use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;

class MediaItemList extends FormRequest
{

    protected function failedValidation(Validator $validator)
    {

    }

    /**
     * Get data to be validated from the request.
     *
     * @return array
     */
    public function validationData(): array
    {
        return [
            'lastId' => $this->input('lastId'),
            'typeFilter' => $this->input('typeFilter'),
            'relatedFilter' => $this->input('relatedFilter'),
            'rowCount' => $this->input('rowCount'),
            'searchString' => $this->input('searchString'),
            'isPrivate' => $this->input('isPrivate') == 'true'
        ];
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'lastId' => 'integer',
            'typeFilter' => 'array',
            'relatedFilter' => 'alpha_dash',
            'rowCount' => 'integer',
            'searchString' => '',
            'isPrivate' => 'bool',
        ];
    }

}
