<?php



namespace App\Http\Requests;



use App\Models\Sample;

use Illuminate\Foundation\Http\FormRequest;

use Illuminate\Validation\Rule;

use Illuminate\Validation\Rules\Unique;



class SampleCreateRequest 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 [

            'patient_id' => 'required|integer|min:1',

            /*'sample_number' => [

                'required',

                Rule::unique(Sample::getTableNameByConnection(), 'sample_number')

            ],*/

            'physician_id' => 'required|integer',
 	        'sample_source_id' => 'required|integer',
            'sample_condition' => 'nullable',

            'reject_comment_id' => 'nullable',

            'collected_date' => 'required|date',

            'received_date' => 'required|date',

            'admission_date' => 'required|date',

            'diagnosis' => 'nullable',

            'is_urgent' => 'required|integer'

        ];

    }



    public function messages()

    {

        return [

            //'reject_comment_id.required_if' => 'Reject reason is required.'

        ];

    }



}

