<?php

namespace Modules\DentalClinic\Entities;

use Illuminate\Database\Eloquent\Model;
use Modules\ClinicCore\Entities\ClcPatient;

/**
 * A performed dental procedure on a shared ClinicCore patient (optionally tied
 * to a clc appointment). procedure_name is a plain string so that, when named
 * to match an ERP product, MedBilling's ChargeCaptureService can resolve it
 * into a billable charge.
 */
class DentalProcedure extends Model
{
    protected $table = 'dental_procedures';
    protected $guarded = ['id'];

    protected $casts = [
        'materials'    => 'array',
        'performed_at' => 'datetime',
    ];

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