<?php

namespace Modules\DentalClinic\Entities;

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

/**
 * One line of a dental treatment plan (builder rows). A plan is the set of
 * items sharing the same (patient_id, plan_name). Once converted to a shared
 * ClinicCore treatment plan, clc_treatment_plan_id links back to it.
 */
class DentalTreatmentPlanItem extends Model
{
    protected $table = 'dental_treatment_plan_items';
    protected $guarded = ['id'];

    protected $casts = [
        'estimated_cost' => 'decimal:2',
        'sort_order'     => 'integer',
    ];

    public const URGENCIES = ['elective', 'soon', 'urgent', 'emergency'];
    public const STATUSES  = ['planned', 'scheduled', 'completed', 'cancelled'];

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