<?php

namespace App\Models;

use App\Models\Aktivitas;
use App\Models\KadarGula;
use App\Models\JenisKelamin;
use App\Models\KebutuhanKalori;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Pasien extends Model
{
    use HasFactory;

    protected $table = 'pasien';
    protected $primaryKey = 'id';
    protected $fillable = [
        'nama',
        'jenis_kelamin_id',
        'umur',
        'berat',
        'tinggi',
        'aktivitas_id',
        'kadar_gula_id',
        'kebutuhan_kalori_id',
        'status',
    ];

    public function jenisKelamin()
    {
        return $this->belongsTo(JenisKelamin::class, 'jenis_kelamin_id');
    }
    public function aktivitas()
    {
        return $this->belongsTo(Aktivitas::class, 'aktivitas_id');
    }
    public function kebutuhanKalori()
    {
        return $this->belongsTo(KebutuhanKalori::class, 'kebutuhan_kalori_id');
    }
    public function kadarGula()
    {
        return $this->belongsTo(KadarGula::class, 'kadar_gula_id');
    }
}
