<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class MedicalRecord extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'doctor_id','patient_id','appointment_id','visit_date',
        'chief_complaint','diagnosis','symptoms','examination_notes',
        'prescriptions','instructions','follow_up_notes','next_visit_date',
        'blood_pressure','temperature','pulse','oxygen_saturation','weight',
        'is_confidential',
    ];

    protected $casts = [
        'visit_date'       => 'date',
        'next_visit_date'  => 'date',
        'prescriptions'    => 'array',
        'is_confidential'  => 'boolean',
        'temperature'      => 'decimal:1',
        'weight'           => 'decimal:2',
    ];

    public function doctor()      { return $this->belongsTo(Doctor::class); }
    public function patient()     { return $this->belongsTo(Patient::class); }
    public function appointment() { return $this->belongsTo(Appointment::class); }
}
