<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Lab extends Model
{
    use HasFactory;

    protected $table = 'lab'; // This is optional if your table name is 'lab'

    protected $fillable = [
        'hcp_id',
        'reason_for_blood_work',
        'other_reason',
        'basic_panel',
        'basic_panel_options',
        'thyroid_tests',
        'specialty_tests',
        'cardiac_tests',
        'inflammatory_tests',
        'hormone_tests',
         'patient_id',
        
    ];

    protected $casts = [
        'reason_for_blood_work' => 'array',
        'basic_panel' => 'array',
        'basic_panel_options' => 'array',
        'thyroid_tests' => 'array',
        'specialty_tests' => 'array',
        'cardiac_tests' => 'array',
        'inflammatory_tests' => 'array',
        'hormone_tests' => 'array',
    ];
    
    
    public function patient()
{
    return $this->belongsTo(Patient::class, 'patient_id', 'patient_id');
}

public function hcp()
{
    return $this->belongsTo(Hcp::class, 'hcp_id', 'hcp_id'); 
}


public function labReport()
{
    return $this->hasOne(LabReport::class, 'lab_id');
}


}



