// Path: src/main/java/com/webfluxclient/codec/HttpErrorReader.java
// public interface HttpErrorReader {
// 
//     /**
//      * Whether the given {@link HttpStatus} is supported by this reader.
//      * @param httpStatus received by the client
//      * @return {@code true} if supported, {@code false} otherwise
//      */
//     boolean canRead(HttpStatus httpStatus);
// 
//     /**
//      * Read from the input message and return a error {@link Flux}
//      *
//      * @param inputMessage the message to read from
//      * @return the error {@link Flux} with the decoded exception
//      * */
//     <T> Flux<T> read(ClientHttpResponse inputMessage);
// 
//     /**
//      * Read from the input message and return a error {@link Mono}
//      *
//      * @param inputMessage the message to read from
//      * @return the error {@link Mono} with the decoded exception
//      * */
//     <T> Mono<T> readMono(ClientHttpResponse inputMessage);
// 
// }
// 
// Path: src/main/java/com/webfluxclient/utils/Types.java
// public static boolean isFlux(ResolvableType bodyType){
//     return FLUX_TYPE.isAssignableFrom(bodyType);
// }
// 
// Path: src/main/java/com/webfluxclient/utils/Types.java
// public static boolean isMono(ResolvableType bodyType){
//     return MONO_TYPE.isAssignableFrom(bodyType);
// }
// 
// Path: src/main/java/com/webfluxclient/utils/Types.java
// public static boolean isVoid(ResolvableType bodyType) {
//     return VOID_TYPE.isAssignableFrom(bodyType);
// }


import com.webfluxclient.codec.HttpErrorReader;
import lombok.AllArgsConstructor;
import org.reactivestreams.Publisher;
import org.springframework.core.ResolvableType;
import org.springframework.http.client.reactive.ClientHttpResponse;
import org.springframework.web.reactive.function.BodyExtractor;
import org.springframework.web.reactive.function.BodyExtractors;
import org.springframework.web.reactive.function.client.ClientResponse;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.List;
import static com.webfluxclient.utils.Types.isFlux;
import static com.webfluxclient.utils.Types.isMono;
import static com.webfluxclient.utils.Types.isVoid;
package com.webfluxclient.client;




@AllArgsConstructor
public class DefaultResponseBodyProcessor implements ResponseBodyProcessor {
    private List<HttpErrorReader> httpErrorReaders;

    @Override
    public Object process(Mono<ClientResponse> monoResponse, ResolvableType bodyType) {
        if (isMono(bodyType)) {
            return toMono(monoResponse, bodyType.getGeneric(0).getRawClass());
        }
// Path: src/main/java/com/webfluxclient/codec/HttpErrorReader.java
// public interface HttpErrorReader {
// 
//     /**
//      * Whether the given {@link HttpStatus} is supported by this reader.
//      * @param httpStatus received by the client
//      * @return {@code true} if supported, {@code false} otherwise
//      */
//     boolean canRead(HttpStatus httpStatus);
// 
//     /**
//      * Read from the input message and return a error {@link Flux}
//      *
//      * @param inputMessage the message to read from
//      * @return the error {@link Flux} with the decoded exception
//      * */
//     <T> Flux<T> read(ClientHttpResponse inputMessage);
// 
//     /**
//      * Read from the input message and return a error {@link Mono}
//      *
//      * @param inputMessage the message to read from
//      * @return the error {@link Mono} with the decoded exception
//      * */
//     <T> Mono<T> readMono(ClientHttpResponse inputMessage);
// 
// }
// 
// Path: src/main/java/com/webfluxclient/utils/Types.java
// public static boolean isFlux(ResolvableType bodyType){
//     return FLUX_TYPE.isAssignableFrom(bodyType);
// }
// 
// Path: src/main/java/com/webfluxclient/utils/Types.java
// public static boolean isMono(ResolvableType bodyType){
//     return MONO_TYPE.isAssignableFrom(bodyType);
// }
// 
// Path: src/main/java/com/webfluxclient/utils/Types.java
// public static boolean isVoid(ResolvableType bodyType) {
//     return VOID_TYPE.isAssignableFrom(bodyType);
// }


// Path: src/main/java/com/webfluxclient/client/DefaultResponseBodyProcessor.java
import com.webfluxclient.codec.HttpErrorReader;
import lombok.AllArgsConstructor;
import org.reactivestreams.Publisher;
import org.springframework.core.ResolvableType;
import org.springframework.http.client.reactive.ClientHttpResponse;
import org.springframework.web.reactive.function.BodyExtractor;
import org.springframework.web.reactive.function.BodyExtractors;
import org.springframework.web.reactive.function.client.ClientResponse;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.List;
import static com.webfluxclient.utils.Types.isFlux;
import static com.webfluxclient.utils.Types.isMono;
import static com.webfluxclient.utils.Types.isVoid;

package com.webfluxclient.client;




@AllArgsConstructor
public class DefaultResponseBodyProcessor implements ResponseBodyProcessor {
    private List<HttpErrorReader> httpErrorReaders;

    @Override
    public Object process(Mono<ClientResponse> monoResponse, ResolvableType bodyType) {
        if (isMono(bodyType)) {
            return toMono(monoResponse, bodyType.getGeneric(0).getRawClass());
        }
        else if (isFlux(bodyType)) {