<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'patient_id' => ['required', 'exists:patients,id'],
            'therapist_id' => ['required', 'exists:users,id'],
            'appointment_date' => ['required', 'date'],
            'duration_minutes' => ['required', 'integer', 'min:15'],
            'type' => ['nullable', 'in:session,assessment,follow-up'],
            'room' => ['nullable', 'string', 'max:50'],
            'status' => ['required', 'in:scheduled,confirmed,in_progress,completed,cancelled,no_show'],
            'notes' => ['nullable', 'string'],
            'cancellation_reason' => ['nullable', 'string', 'required_if:status,cancelled'],
        ];
    }
}
