<?php

namespace App\Rules;

use Closure;
use Illuminate\Contracts\Validation\ValidationRule;

class DowranAgaAllowed implements ValidationRule
{
    /**
     * Run the validation rule.
     *
     * @param  \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString  $fail
     */
    public function validate(string $attribute, mixed $value, Closure $fail): void
    {
        $pattern = "/^[a-zA-Z0-9\s\(\)\"\'\-\žŽäÄňŇöÖşŞüÜçÇýÝ\/,]+$/u";

        if (! preg_match($pattern, $value)) {
            $fail(__('Write a correct data please'));
        }
    }
}
