<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Visit extends Model
{
    protected $guarded = [];

    protected $casts = [
        'visit_date' => 'datetime',
        'status' => 'string', // Pending, Confirmed, Completed, Cancelled, No-show
    ];

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

    public function chamber()
    {
        return $this->belongsTo(Chamber::class);
    }

    public function encounter()
    {
        return $this->hasOne(Encounter::class);
    }

    public function prescription()
    {
        return $this->hasOneThrough(Prescription::class , Encounter::class);
    }
}
