package cz.moneta.test.harness.endpoints;

import cz.moneta.test.harness.connectors.rest.ExtendedRestResponse;
import cz.moneta.test.harness.context.StoreAccessor;
import org.apache.commons.lang3.tuple.Pair;

import jakarta.ws.rs.client.Entity;
import java.util.Map;

public interface RestEndpoint extends Endpoint {
    <T> Pair<Integer, T> get(String path, Map<String, Object> properties, Class<T> responseType, Map<String, Object> headers);

    //TODO - make jackson pick up the correct generic type rather than a linked hash map
    <T> Pair<Integer, T> post(String path, Entity<?> request, Class<T> responseType, Map<String, Object> headers, boolean rawResponse);

    default <T> Pair<Integer, ExtendedRestResponse<T>> postExtended(String path, Entity<?> request,
                                                                    Class<T> responseType,
                                                                    Map<String, Object> headers) {
        throw new UnsupportedOperationException(String.format("Endpoint %s does not support extended request yet. Talk to the Harness support team about it", this.getClass().getSimpleName()));
    }

    <T> Pair<Integer, T> delete(String path, Map<String, Object> properties, Class<T> responseType, Map<String, Object> headers);

    <T> Pair<Integer, T> patch(String path, Entity<?> request, Class<T> responseType, Map<String, Object> headers, boolean rawResponse);

    StoreAccessor getStore();
}
