<?php

namespace App\Core\Validator\PropertyWeb;

use App\Models\PropertyWeb;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Translation\Translator;

use App\Core\Validator\BaseValidator;

class PropertyWebContactFormValidator extends BaseValidator
{

    public function __construct
    (
        Translator $translator,
        Container $container
    )
    {
        parent::__construct($translator, $container);
    }

    public function rules($params = null)
    {
        return
            [
                "name" => 'required',
                "surname" => 'required',
                "email" => "required|email",
                "phone" => "required",
                "message" => 'required|min:10',
            ];
    }

    public function messages()
    {
        $thisMessages = [
            'message.min' => __('error-input-min', ['input' => __('myweb-input-message')]),
            'message.required' =>  __('error-input-required', ['input' => __('myweb-input-message')]),
            'phone.required' =>  __('error-input-required', ['input' => __('enw-input-phone')]),
        ];
        return array_merge(parent::messages() , $thisMessages);
    }



    public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
    {
        return $this->make($params, $this->rules($params), $this->messages());
    }

}
