<?php

namespace App\Models;

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

class ClaimHistoryCare extends Model
{
    use HasFactory;
    protected $fillable = [
        'service_code',
        'admission_date',
        'discharge_date',
        'claim_id',
        'organization_id',
        'practitioner_id',
        'medical_record_number',
        'symptoms',
        'sign',
        'main_diagnosis_id',
        'status'
    ];

    protected $hidden = [
        'created_at',
        'updated_at',
    ];

    public function organization()
    {
        return $this->belongsTo(Organization::class, 'organization_id');
    }

    public function practitioner()
    {
        return $this->belongsTo(Practitioner::class, 'practitioner_id');
    }

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

    public function claim()
    {
        return $this->hasOne(Claim::class, 'claim_id');
    }

    public function person()
    {
        return $this->belongsTo(Person::class, 'practitioner_id');
    }

    public function comparativeDiagnosis()
    {
        return $this->hasMany(DiagnosisSecondaryClaimHistoryCare::class, 'claim_history_care_id');
    }

}
