<?php
namespace App\Http\Requests\Admin;

use App\Floor;
use Illuminate\Foundation\Http\FormRequest;

class StoreSectionsRequest 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()
    {
        $maxFloor = Floor::query()->max('name');

        return [
//            'number' => 'max:191|required',
            'name' => 'max:192',
//            'section_type_id' => 'required',
            'number_entrance_house' => 'max:'. $maxFloor .'|nullable|numeric',
            'count_of_floor' => 'max:'. $maxFloor .'|nullable|numeric',
            'date_start_building' => 'nullable|date_format:'.config('app.date_year_format'),
            'date_finish_buildiing' => 'nullable|date_format:'.config('app.date_year_format'),
            'residental_complex_id' => 'required',
        ];
    }
}
