<?php

namespace Modules\ClinicCore\Entities;

use Illuminate\Database\Eloquent\Model;

class ClcPatientCondition extends Model
{
    protected $table = 'clc_patient_conditions';
    protected $guarded = ['id'];

    protected $casts = [
        'diagnosed_date' => 'date',
        'resolved_date'  => 'date',
    ];

    /** P3-T8 problem-list enums. */
    public const CERTAINTIES     = ['confirmed', 'probable', 'possible'];
    public const CONDITION_TYPES = ['diagnosis', 'symptom', 'finding', 'condition', 'risk_factor'];

    public function pet()
    {
        return $this->belongsTo(ClcPatient::class, 'patient_id');
    }

    public function condition()
    {
        return $this->belongsTo(ClcMedicalCondition::class, 'condition_id');
    }

    public function doctor()
    {
        return $this->belongsTo(ClcDoctor::class, 'diagnosed_by');
    }
}
