<?php

declare(strict_types=1);

namespace App\Http\Requests\Report;

use Illuminate\Foundation\Http\FormRequest;

class StoreFeedingLogRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'report_id' => ['nullable', 'integer', 'exists:reports,id'],
            'feeding_meal_id' => ['nullable', 'integer', 'exists:report_feeding_meals,id'],
            'fed_at_date' => ['required', 'date'],
            'meal_time' => ['nullable', 'string', 'max:20'],
            'meal_name' => ['nullable', 'string', 'max:255'],
            'photos' => ['nullable', 'array'],
            'photos.*' => ['string', 'max:500'],
            'notes' => ['nullable', 'string'],
        ];
    }

    public function messages(): array
    {
        return [
            'fed_at_date.required' => 'تاریخ خوراک‌دهی الزامی است.',
        ];
    }
}
