<?php

namespace App\Packages\v4\User\Requests;

use Illuminate\Foundation\Http\FormRequest;

/**
 * Class UserEmailRequest
 * @package App\Packages\User\Requests
 *
 * @property $first_name
 * @property $last_name
 * @property $bio
 * @property $about
 *
 * @property $newFirstName
 */
class PersonalRequest extends FormRequest
{
	/**
	 * @return bool
	 */
	public function authorize()
	{
		return true;
	}

	public function rules()
	{
		return [
			'first_name' => ['nullable', 'string', 'min:3', 'max:255'],
			'last_name' => ['nullable', 'string', 'min:3', 'max:255'],
			'bio' => ['nullable', 'string', 'min:5', 'max:150'],
			'about' => ['nullable', 'string', 'min:10', 'max:2500'],
		];
	}

	/**
	 * @return array
	 */
	public function attributes()
	{
		return [
			'first_name' => trans('forms.forms.first_name'),
			'last_name' => trans('forms.forms.last_name'),
			'bio' => trans('forms.forms.user_bio'),
			'about' => trans('forms.forms.user_about'),
		];
	}

//	/**
//	 * @param \Illuminate\Validation\Factory $factory
//	 *
//	 * @return \Illuminate\Contracts\Validation\Validator
//	 */
//	public function validator($factory)
//	{
//		return CustomValidatorFactory::makeWithFactory(
//			TestValidator::class,
//			$this->input(),
//			$factory
//		);
//	}
//
//	/**
//	 * Configure the validator instance.
//	 *
//	 * @param  \Illuminate\Validation\Validator $validator
//	 * @return void
//	 */
//	public function withValidator($validator)
//	{
//		$validator->after(function($validator) {
//
//			/** @var Validator $validator */
//			// add custom features to validtion
//			$validator->errors()->add('first_name', 'fuck this shit');
//		});
//	}
}
