<?php

namespace App\Models;

# use Illuminate\Database\Eloquent\Model;

class Measurement extends Model
{
    protected $table = 'measurement';

    public function client()
    {
        return $this->hasOne(Client::class, 'id', 'client_id');
    }

    public function careMonth()
    {
        return $this->hasOne(CareMonth::class, 'id', 'care_month_id');
    }

    public function clientBDTMeasurement()
    {
        return $this->hasOne(ClientBDTMeasurement::class, 'id', 'client_bdt_measurement_id');
    }

    public function childMeasurements() {
        return Measurement::where('parent_measurement_id', $this->id)
            ->where('is_active', true)
            ->get();
    }
}
