package br.com.tasknoteapp.server.hint;

import jakarta.servlet.http.HttpServletRequest;
import org.jspecify.annotations.NonNull;
import org.springframework.aot.hint.ProxyHints;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;

/** This class creates a RuntimeHint for the ServletRequest class. */
public class HttpServletRequestRuntimeHint implements RuntimeHintsRegistrar {

  @Override
  public void registerHints(@NonNull RuntimeHints hints, ClassLoader classLoader) {
    try {
      ProxyHints proxies = hints.proxies();
      proxies.registerJdkProxy(HttpServletRequest.class);
    } catch (Exception e) {
      throw new RuntimeException("Could not register RuntimeHint: " + e.getMessage());
    }
  }
}
