<?php

namespace App\Http\Requests\Api;

use App\RoomCount;
use App\RoomType;
use App\Section;
use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
//        $roomCount = RoomCount::query()->pluck('count');
//        $roomTypes = RoomType::query()->pluck('code');
//        $rooms = array_merge($roomCount->toArray(), $roomTypes->toArray());
//
//        $explodedRooms = implode( ',', $rooms);

        return [
//            'room_types.*' => 'nullable|in:' . $explodedRooms,
            'section_ids'=> 'nullable|exists:sections,id',
            'min_space' => 'nullable|min:0|max:199',
            'max_space' => 'nullable|min:0|max:199',
            'floors' => 'nullable|min:0|max:9999',
            'page'=> 'nullable|numeric|min:0|max:9999',
        ];
    }
}
