<?php

namespace Modules\VetAdmission\Entities;

use Illuminate\Database\Eloquent\Model;

class VaWard extends Model
{
    protected $table = 'va_wards';
    protected $guarded = ['id'];

    public function admissions()
    {
        return $this->hasMany(VaAdmission::class, 'ward_id');
    }

    public function currentAdmissions()
    {
        return $this->hasMany(VaAdmission::class, 'ward_id')->where('status', 'admitted');
    }

    public function scopeActive($query)
    {
        return $query->where('status', 'active');
    }

    public function scopeForBusiness($query, $businessId)
    {
        return $query->where('business_id', $businessId);
    }
}
