<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class WatchlistItemsRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'page' => 'nullable|integer',
            'itemsPerPage' => 'nullable|integer|max:100',
            // 'expiredOnly' => 'nullable|boolean',
            'orderDir' => 'nullable|string|in:asc,desc',
        ];
    }

    /**
     * Get the validation data that should be used for validation.
     *
     * @return array
     */
    public function validationData(): array
    {
        return [
            'page' => $this->input('page', 1),
            'itemsPerPage' => $this->input('itemsPerPage', 20),
            // 'expiredOnly' => $this->input('expiredOnly', false),
            'orderDir' => $this->input('orderDir', 'desc'),
        ];
    }
}
