<?php

namespace Modules\ClinicCore\Entities;

use Illuminate\Database\Eloquent\Model;

/**
 * SIFA P3-T1 — immutable audit row for a completed patient merge.
 */
class ClcPatientMergeLog extends Model
{
    protected $table = 'clc_patient_merge_logs';
    protected $guarded = ['id'];

    protected $casts = [
        'before' => 'array',
        'after'  => 'array',
    ];

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

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