<?php
namespace App\Model;
use App\Model\BaseModel;
use App\Core\Service\Logger;

class ClientUserModel extends BaseModel
{
    public function __construct() {
        parent::__construct();
    }

    public function getAllChildUsers($user_id) {
        try {
            $resp = $this->callProcedure($this->procedures['GetChildUsers'], ['user_id'=>$user_id], true);
            if(!$resp['status']) {
                throw new \Exception($resp['error']);
            }
            return ["status" => true, "data"=>$resp['data']['child_users']];
        } catch (\Exception $e) {
            Logger::error($e->getMessage(), ['File' => $e->getFile(), 'Line' => $e->getLine()]);
            return ["status" => false, "error" => $e->getMessage()];
        }
    }
}