<?php

namespace Modules\VetClinic\Entities;

use Illuminate\Database\Eloquent\Model;
use App\BusinessLocation;

class VcClinicLocation extends Model
{
    protected $table = 'vc_clinic_locations';
    protected $guarded = ['id'];

    public function departments()
    {
        return $this->hasMany(VcDepartment::class, 'location_id');
    }

    public function businessLocation()
    {
        return $this->belongsTo(BusinessLocation::class, 'business_location_id');
    }

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

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