<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;

class UpdateFormEvent 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(Request $request)
    {
        if ($request->event_date_check == null) {

            return [
                'profile_id'           => ['required'],
                'title'                => ['required'],
                'description'          => ['required'],
                'event_date'           => ['required'],
                'event_time'           => ['required'],
                'event_venue'          => ['required'],
                'event_disexp'         => ['required'],
                'event_participants'   => ['required'],
                'event_contact_name'   => ['required'],
                'event_contact_email'  => ['required'],
                'event_contact_tel'    => ['required'],
                'event_web'            => ['required'],
                'event_twitter'        => ['required'],
                'event_facebook'       => ['required'],
                'event_other'          => ['required'],
                'event_foundation'     => ['required'],
                'event_interest'       => 'required|array',
                'event_interviewed'    => 'required',
                'event_applicant'      => ['required'],



            ];
        } else {

            return [

                'profile_id'           => ['required'],
                'title'                => ['required'],
                'description'          => ['required'],
                'event_disexp'         => ['required'],
                'event_participants'   => ['required'],
                'event_contact_name'   => ['required'],
                'event_contact_email'  => ['required'],
                'event_contact_tel'    => ['required'],
                'event_web'            => ['required'],
                'event_twitter'        => ['required'],
                'event_facebook'       => ['required'],
                'event_other'          => ['required'],
                'event_foundation'     => ['required'],
                'event_interest'       => 'required|array',
                'event_interviewed'    => 'required',
                'event_applicant'      => ['required'],


            ];


        }

    }

    public function messages()
    {
        return [
            'profile_id.required' => 'Debe seleccionar Perfil relacionado a la tarea.',
            'title.required' => 'El campo Título es requerido.',
            'description.required' => 'El campo Descripción es requerido.',
            'event_disexp.required' => 'EL campo Disertante / Expositor es requerido.',
            'event_participants.required' => 'EL campo áreas participantes es requerido.',
            'event_contact_name.required' => 'EL campo nombre es requerido, escriba "No poseo" si no corresponde.',
            'event_contact_email.required' => 'EL campo email es requerido, escriba "No poseo" si no corresponde.',
            'event_contact_tel.required' => 'EL campo teléfono es requerido, escriba "No poseo" si no corresponde.',
            'event_web.required' => 'EL campo Sitio Web es requerido,escriba "No poseo" si no corresponde.',
            'event_twitter.required' => 'EL campo Twitter es requerido,escriba "No poseo" si no corresponde.',
            'event_facebook.required' => 'EL campo Facebook requerido,escriba "No poseo" si no corresponde.',
            'event_other.required' => 'EL campo otros es requerido,escriba "No poseo" si no corresponde.',
            'event_foundation.required' => 'EL campo fundamentación es requerido.',
            'event_applicant.required' => 'EL campo Datos de contacto del Solicitante es requerido.',
            'event_interest.required' => 'Seleccione un itém en interés.',
            'event_interviewed.required' => 'EL campo posibles Entrevistados es requerido.',
            'event_date.required' => 'El campo fecha es requerido',
            'event_time.required' => 'El campo horario es requerido',
            'event_venue.required' => 'El campo lugar es requerido',

        ];

    }
}
