<?php
    /**
     * ================================================================================================================|
     * Модель для форм отзыва на openeurope
     * ================================================================================================================|
     */
    
namespace frontend\models;
use artbox\core\models\Feedback as ArtboxCoreFeedback;


class Feedback extends ArtboxCoreFeedback
{
	public $reCaptcha;


	public function rules()
    {


	    return [
            [
                [
                    'name',
                    'email',
	                'phone',
                ],
                'required',
                'on'      => self::SCENARIO_DEFAULT,
                'message' => \Yii::t('app', 'Empty field'),
            ],
		    ['reCaptcha', \himiklab\yii2\recaptcha\ReCaptchaValidator::className(),
			    'uncheckedMessage' => 'Please confirm that you are not a bot.',
			    // add follow lines to prevent checking recaptcha when from has errors
			    'when' => function ($model) {
				    return !$model->hasErrors();
			    },
		    ],
//			[
//				'reCaptcha','safe'
//			],
		    [
                [
                    'name',
                    'email',
                ],
                'required',
                'on'      => self::SCENARIO_FEEDBACK,
                'message' => \Yii::t('app', 'Empty field'),
            ],
            [
                [
                    'phone',
                    'name',
                ],
                'required',
                'on' => self::SCENARIO_CALLBACK,

            ],
            [
                [ 'email' ],
                'email',
                'message' => \Yii::t('app', 'Wrong email'),
            ],
            [
                [
                    'name',
                    'phone',
                    'email',
                ],
                'string',
                'max' => 255,
            ],
            [
                [
                    'message',
                ],
                'string',
            ],
            [
                [
                    'status',
                ],
                'boolean',
            ],
            [
                'returnUrl',
                'safe',
            ],

        ];
    }
    
}