<?php

namespace App\Models;

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

class EncounterDiagnosis extends Model
{
    use HasFactory;

    public $fillable = [
        'encounter_id',
        'diagnosis_id',
        'type',
        'use',
        'source',
        'description',
    ];

    public static $use_enums = [
        'working' => 'Working',
        'final' => 'Final'
    ];

    public static $type_enums = [
        'primary' => 'Primary',
        'secondary' => 'Secondary'
    ];

    public function encounter()
    {
        return $this->belongsTo(Encounter::class, 'encounter_id');
    }

    public function diagnosis()
    {
        return $this->belongsTo(Icd::class, 'diagnosis_id');
    }
}
