<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class DentalTooth extends Model
{
    public const STATUS_PRESENT = 'present';

    public const STATUS_MISSING = 'missing';

    public const STATUS_EXTRACTED = 'extracted';

    public const STATUS_IMPLANT = 'implant';

    protected $table = 'care_dental_teeth';

    protected $fillable = [
        'dental_chart_id', 'tooth_code', 'status', 'surfaces', 'conditions', 'notes',
    ];

    protected function casts(): array
    {
        return [
            'surfaces' => 'array',
            'conditions' => 'array',
        ];
    }

    public function chart(): BelongsTo
    {
        return $this->belongsTo(DentalChart::class, 'dental_chart_id');
    }
}
