<?php

namespace App\Http\Requests\Admin;

use App\Models\Question;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class QuestionRequest 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()
    {
        return [
            'number' => 'required|int|max:100',
            'text' => 'required|string|max:255',
            'type' => 'required|' . Rule::in(array_keys(Question::TYPE_OPTIONS)),
            'standard' => 'int|max:12',
        ];
    }
}
