supervisorModel = new SupervisorModel; $this->atendimentoModel = new AtendimentoModel; $this->parametrosModel = new ParametrosModel; } function __invoke($agente): string { $atendimentosAbertos = $this->atendimentoModel->getAtendimentoAbertoByAgente($agente->matricula); $param = $this->parametrosModel->get([]); if ($agente->status == CONF_AGENT_STATUS_LIVRE || $agente->status == CONF_AGENT_STATUS_OCUPADO) { if (count($atendimentosAbertos) < $param->prm_media_simultaneo) { $this->supervisorModel->update(['matricula' => $agente->matricula, 'status' => CONF_AGENT_STATUS_LIVRE]); return CONF_AGENT_STATUS_LIVRE; } else { $this->supervisorModel->update(['matricula' => $agente->matricula, 'status' => CONF_AGENT_STATUS_OCUPADO]); return CONF_AGENT_STATUS_OCUPADO; } } if ($agente->status == CONF_AGENT_STATUS_INDISPONIVEL) { if (empty($atendimentosAbertos)) { $action = new EntrarPausaAction(); return $action($agente, $agente->motivo_pausa); } } } }