package com.airlock.iam.common.infrastructure.restclient;

import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.StatusType;
import java.net.URI;

public record RestResponse(Response response, URI invokedUri) implements AutoCloseable {
   @Override
   public void close() {
      this.response.close();
   }

   public int status() {
      return this.response.getStatus();
   }

   public StatusType statusInfo() {
      return this.response.getStatusInfo();
   }

   public <T> T readEntity(Class<T> entityType) {
      return (T)this.response.readEntity(entityType);
   }
}
