<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ExternalCourseRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        // only allow updates if the user is logged in
        return backpack_auth()->check();
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'rhythm_id' => 'required',
            'partner_id' => 'required',
            'volume' => 'required|numeric',
            'name' => 'required|min:1|max:100',
            'hourly_price' => 'required|numeric|min:0',
            'start_date' => 'required|date',
            'end_date' => 'required|date',
            'period_id' => 'required|numeric',
            'head_count' => 'required|numeric',
            'new_students' => 'required|numeric',
            'times.*.day' => 'required',
            'times.*.start' => 'required',
            'times.*.end' => 'required',
        ];
    }

    /**
     * Get the validation attributes that apply to the request.
     */
    public function attributes(): array
    {
        return [
            //
        ];
    }

    /**
     * Get the validation messages that apply to the request.
     */
    public function messages(): array
    {
        return [
            //
        ];
    }
}
