<?php

namespace App\Models;
use App\Enums\RecordStatusEnum;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class TestResult extends BaseModel
{
    public $timestamps = false;
    use HasFactory;
    /**
     * The table associated with the model.
     *
     * @var string
     */

    //protected $appends = ['usd_price'];

    public static function boot()
    {
        parent::boot();
    }

    protected $fillable = ['sample_id', 'test_sample_id','test_result', 'is_show', 'test_date', 'performed_by', 'lab_id', BaseModel::CREATED_AT_FIELD, BaseModel::CREATED_BY_FIELD];

    function testSample(){
        return $this->belongsTo(TestSample::class,'test_sample_id','id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
    }

//    function organismResults(){
//        return $this->hasMany(OrganismResult::class,'test_result_id','id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
//    }

//    function getUsdPriceAttribute(){
//        return TestSample::query()->find($this->test_sample_id)->first()->usd_price;
//    }


}
