<?php

namespace App\Http\Requests\Coach;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class StoreCoachAssessmentRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()->isCoach();
    }

    public function rules(): array
    {
        return [
            'weight_kg' => ['required', 'numeric', 'min:20', 'max:300'],
            'height_cm' => ['required', 'integer', 'min:100', 'max:250'],
            'athlete_level' => ['nullable', Rule::in(['beginner', 'intermediate', 'advanced'])],
            'training_history' => ['nullable', 'string', 'max:2000'],
            'goal_id' => ['nullable', 'integer', 'exists:goals,id'],

            // برخلاف فرم ورزشکار، اینجا مربی مستقیم می‌تواند درصد چربی را وارد کند (بند ۹)
            'body_fat_percentage' => ['nullable', 'numeric', 'min:2', 'max:60'],

            'waist_cm' => ['nullable', 'numeric', 'min:0', 'max:300'],
            'arm_cm' => ['nullable', 'numeric', 'min:0', 'max:100'],
            'thigh_cm' => ['nullable', 'numeric', 'min:0', 'max:150'],
            'chest_cm' => ['nullable', 'numeric', 'min:0', 'max:300'],

            'coach_notes' => ['nullable', 'string', 'max:1000'],
        ];
    }
}
