<?php

namespace Functional\Tracking\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

/**
 * Validation du log d'une série (POST /api/sessions/{session}/sets).
 */
class StoreSetLogRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'exercise_id' => ['required', 'integer', 'exists:exercises,id'],
            'set_number' => ['required', 'integer', 'min:1'],
            'reps' => ['nullable', 'integer', 'min:0'],
            'weight' => ['nullable', 'numeric', 'min:0'],
            'rpe' => ['nullable', 'numeric', 'between:0,10'],
            'duration_seconds' => ['nullable', 'integer', 'min:0'],
            'distance_meters' => ['nullable', 'numeric', 'min:0'],
            'is_warmup' => ['sometimes', 'boolean'],
        ];
    }
}
