<?php

namespace lib\Services;

use lib\Entities\VPCEntity;
use lib\Models\VPCModel;

class VPCService extends CommonService
{
  private ?VPCModel $_model = null;
  public function __construct()
  {
    parent::__construct();
  }
  final public function getClassName(): string
  {
    return "VPC";
  }
  final public function getClassPath(): string
  {
    return $this->getClassName();
  }
  public function getModel(): VPCModel
  {
    if ($this->_model === null) {
      $this->_model = new VPCModel();
      // $this->_model->setDebug(true);
    }
    return $this->_model;
  }

  public function getCountByServiceCode(string $service_code): int
  {
    $this->getModel()->where("service_code", $service_code);
    $count =  $this->getModel()->countAllResults();
    // echo "<BR>" . $this->getModel()->getLastQuery();
    return $count;
  }
}
