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

use Illuminate\Foundation\Http\FormRequest;

class StoreCustomerAppealsRequest 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 [
            'question' => 'nullable|max:4000',
            'call_now' => 'nullable|boolean',
            'customer_appeal_option_id' => 'nullable|exists:customer_appeal_options,id',
            'developer_id' => 'nullable|exists:developers,id',
            'planning_id' => 'nullable|exists:plannings,id',
            'residential_complexes_id' => 'nullable|exists:residential_complexes,id',
            'phone' => 'max:45|required',
            'call_time' => 'nullable|date_format:'.config('app.date_format').' H:i:s',
            'name' => 'max:90',
        ];
    }

    public function messages()
    {
        return [
            "exists" => "Не існуючий запис"
        ];
    }
}
