public function complete(?string $nextq = null, int $delay = 0, array $depends = []): string
    {
        if ($this->completed || $this->failed) {
            throw new JobAlreadyFinishedException();
        }

        $params = [
            $this->jid,
            $this->worker,
            $this->queue,
            json_encode($this->data, JSON_UNESCAPED_SLASHES) ?: '{}'
        ];

        if ($nextq) {
            $next = ['next', $nextq, 'delay', $delay, 'depends', json_encode($depends, JSON_UNESCAPED_SLASHES)];
            $params = array_merge($params, $next);
        }

        $this->completed = true;

        return call_user_func_array(
            [$this->client, 'complete'],
            $params
        );
    }