<?php

namespace Functional\Tracking\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

/**
 * Une mensuration ponctuelle de l'utilisateur.
 */
class BodyMetricResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'measured_on' => optional($this->measured_on)->toDateString(),
            'weight' => $this->weight,
            'body_fat' => $this->body_fat,
            'notes' => $this->notes,
        ];
    }
}
