class ClaimedMessagesOutput<K, V> extends CommandOutput<K, V, ClaimedMessages<K, V>> {

    private final boolean justId;

    private final K stream;

    private String startId;

    private String id;

    private boolean hasId;

    private K key;

    private boolean hasKey;

    private Map<K, V> body;

    private boolean bodyReceived;

    private final List<StreamMessage<K, V>> messages;

    public ClaimedMessagesOutput(RedisCodec<K, V> codec, K stream, boolean justId) {
        super(codec, null);
        this.stream = stream;
        this.messages = new ArrayList<>();
        this.justId = justId;
    }

    @Override
    public void set(ByteBuffer bytes) {<FILL_FUNCTION_BODY>}

    @Override
    public void complete(int depth) {

        if (depth == 3 && bodyReceived) {
            messages.add(new StreamMessage<>(stream, id, body == null ? Collections.emptyMap() : body));
            bodyReceived = false;
            key = null;
            hasKey = false;
            body = null;
            id = null;
            hasId = false;
        }

        if (depth == 2 && justId) {
            messages.add(new StreamMessage<>(stream, id, null));
            key = null;
            hasKey = false;
            body = null;
            id = null;
            hasId = false;
        }

        if (depth == 0) {
            output = new ClaimedMessages<>(startId, Collections.unmodifiableList(messages));
        }
    }

}

        if (startId == null) {
            startId = decodeAscii(bytes);
            return;
        }

        if (id == null) {
            id = decodeAscii(bytes);
            return;
        }

        if (justId) {
            return;
        }

        if (!hasKey) {
            bodyReceived = true;
            hasKey = true;

            if (bytes == null) {
                return;
            }

            key = codec.decodeKey(bytes);
            return;
        }

        if (body == null) {
            body = new LinkedHashMap<>();
        }

        body.put(key, bytes == null ? null : codec.decodeValue(bytes));
        key = null;
        hasKey = false;
    
<methods>public void <init>(RedisCodec<K,V>, ClaimedMessages<K,V>) ,public void complete(int) ,public ClaimedMessages<K,V> get() ,public java.lang.String getError() ,public boolean hasError() ,public void multi(int) ,public void multiArray(int) ,public void multiMap(int) ,public void multiPush(int) ,public void multiSet(int) ,public void set(java.nio.ByteBuffer) ,public void set(long) ,public void set(double) ,public void set(boolean) ,public void setBigNumber(java.nio.ByteBuffer) ,public void setError(java.nio.ByteBuffer) ,public void setError(java.lang.String) ,public void setSingle(java.nio.ByteBuffer) ,public java.lang.String toString() <variables>protected final non-sealed RedisCodec<K,V> codec,protected java.lang.String error,protected ClaimedMessages<K,V> output