<?php
namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class StoreDevelopersRequest 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 [
            'name' => 'max:192|required',
            'code' => 'max:192|required|unique:developers,code',
            'description' => 'max:50000|required',
            'logotype_icon' => 'required|mimes:png,jpg,jpeg,gif',
            'banner' => 'nullable|mimes:png,jpg,jpeg,gif',
            'email' => 'email:rfc,dns,filter,spoof|max:45',
            'phone' => 'min:6|max:21|regex:/^(\s*)?(\+)?([- _():=+]*\d[- _():=+]?){6,21}(\s*)?$/',
            'main_page_priority' => 'numeric|min:0|max:10|nullable',
            'build' => 'numeric|min:0|max:999|nullable',
            'being_built' => 'numeric|min:0|max:999|nullable',
            'developer_page_priority' => 'numeric|min:0|max:10|nullable',
            'birthday' => 'nullable',
            'meta_title' => 'max:192',
            'meta_keywords' => 'max:5000',
            'meta_description' => 'max:8000',
            'seo_text' => 'max:25000',
            'facebook' => 'max:192',
            'youtube' => 'max:192',
            'site_link' => 'max:192',
            'city_id' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'banner.mimes' => 'Банер повинен бути формату: png, jpg, jpeg, gif.',
            'logotype_icon.mimes' => 'Логотип повинен бути формату: png, jpg, jpeg, gif.'
        ];
    }
}
