package com.l7tech.server.message;

import com.l7tech.gateway.common.RequestId;
import com.l7tech.gateway.common.audit.Audit;
import com.l7tech.gateway.common.mapping.MessageContextMapping;
import com.l7tech.gateway.common.service.PublishedService;
import com.l7tech.message.Message;
import com.l7tech.policy.assertion.Assertion;
import com.l7tech.policy.assertion.AssertionStatus;
import com.l7tech.policy.assertion.MessageTargetable;
import com.l7tech.policy.assertion.RoutingStatus;
import com.l7tech.policy.variable.NoSuchVariableException;
import com.l7tech.policy.variable.VariableNotSettableException;
import com.l7tech.server.audit.AuditContext;
import com.l7tech.server.message.metrics.LatencyMetrics;
import com.l7tech.server.otel.OtelContext;
import com.l7tech.server.policy.PolicyMetadata;
import com.l7tech.server.policy.assertion.RoutingResultListener;
import com.l7tech.server.policy.assertion.ServerAssertion;
import com.l7tech.server.stepdebug.DebugContext;
import com.l7tech.util.InvalidDocumentFormatException;
import com.l7tech.util.Pair;
import com.l7tech.xml.SoapFaultLevel;
import java.io.Closeable;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.logging.Level;
import javax.wsdl.Binding;
import javax.wsdl.Operation;
import javax.wsdl.WSDLException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.xml.sax.SAXException;

public interface PolicyEnforcementContext extends AssertionOrdinalProcessor, Closeable {
   Message getRequest();

   Message getResponse();

   AuthenticationContext getDefaultAuthenticationContext();

   AuthenticationContext getAuthenticationContext(Message var1);

   @RoutingMetricsRelated
   RoutingStatus getRoutingStatus();

   @RoutingMetricsRelated
   void setRoutingStatus(RoutingStatus var1);

   @RoutingMetricsRelated
   boolean isPostRouting();

   boolean isReplyExpected();

   Level getAuditLevel();

   void setAuditLevel(Level var1);

   RequestId getRequestId();

   void addSeenAssertionStatus(AssertionStatus var1);

   Set<AssertionStatus> getSeenAssertionStatus();

   boolean isAuditSaveRequest();

   void setAuditSaveRequest(boolean var1);

   boolean isAuditSaveResponse();

   void setAuditSaveResponse(boolean var1);

   @Deprecated
   Collection<ServerAssertion> getDeferredAssertions();

   @Deprecated
   void addDeferredAssertion(ServerAssertion var1, ServerAssertion var2);

   @Deprecated
   void removeDeferredAssertion(ServerAssertion var1);

   RoutingResultListener getRoutingResultListener();

   void addRoutingResultListener(RoutingResultListener var1);

   void removeRoutingResultListener(RoutingResultListener var1);

   void setAuthenticationMissing();

   boolean isRequestPolicyViolated();

   void setRequestPolicyViolated();

   void setRequestClaimingWrongPolicyVersion();

   boolean isRequestClaimingWrongPolicyVersion();

   @Nullable
   PublishedService getService();

   void setService(PublishedService var1);

   PolicyMetadata getServicePolicyMetadata();

   void setServicePolicyMetadata(PolicyMetadata var1);

   PolicyMetadata getCurrentPolicyMetadata();

   void setCurrentPolicyMetadata(PolicyMetadata var1);

   PolicyContextCache getCache();

   void setCache(PolicyContextCache var1);

   List<String> getIncrementedCounters();

   void setVariable(@Nullable String var1, @Nullable Object var2) throws VariableNotSettableException;

   Object getVariable(String var1) throws NoSuchVariableException;

   Map<String, Object> getAllVariables();

   Map<String, Object> getVariableMap(String[] var1, Audit var2);

   @RoutingMetricsRelated
   void routingStarted();

   @RoutingMetricsRelated
   void routingFinished();

   @RoutingMetricsRelated
   long getRoutingStartTime();

   @RoutingMetricsRelated
   long getRoutingEndTime();

   @RoutingMetricsRelated
   long getRoutingTotalTime();

   Pair<Binding, Operation> getBindingAndOperation() throws IOException, SAXException, WSDLException, InvalidDocumentFormatException;

   boolean isStealthResponseMode();

   @RoutingMetricsRelated
   long getStartTime();

   long getAssertionLatencyNanos();

   void setAssertionLatencyNanos(long var1);

   @RoutingMetricsRelated
   URL getRoutedServiceUrl();

   @RoutingMetricsRelated
   void setRoutedServiceUrl(URL var1);

   @RoutingMetricsRelated
   long getEndTime();

   @RoutingMetricsRelated
   void setEndTime();

   SoapFaultLevel getFaultlevel();

   void setFaultlevel(SoapFaultLevel var1);

   void assertionStarting(ServerAssertion var1);

   void assertionFinished(ServerAssertion var1, AssertionStatus var2, @Nullable LatencyMetrics var3);

   List<PolicyEnforcementContext.AssertionResult> getAssertionResults();

   Collection<Integer> getAssertionNumber();

   Message getTargetMessage(MessageTargetable var1) throws NoSuchVariableException;

   Message getOrCreateTargetMessage(MessageTargetable var1, boolean var2) throws NoSuchVariableException, VariableNotSettableException;

   Message getTargetMessage(MessageTargetable var1, boolean var2) throws NoSuchVariableException;

   boolean isResponseWss11();

   void setResponseWss11(boolean var1);

   void setMalformedRequest();

   boolean isMalformedRequest();

   void setSavedRequestL7aMessageId(String var1);

   String getSavedRequestL7aMessageId();

   @NotNull
   List<MessageContextMapping> getMappings();

   void setMappings(List<MessageContextMapping> var1);

   Collection<Integer> getAssertionOrdinalPath();

   void pushAssertionOrdinal(int var1);

   int popAssertionOrdinal() throws NoSuchElementException;

   void setTraceListener(AssertionTraceListener var1);

   boolean hasTraceListener();

   AssertionTraceListener getTraceListener();

   boolean isRequestWasCompressed();

   void setRequestWasCompressed(boolean var1);

   AssertionStatus getPolicyResult();

   void setPolicyResult(AssertionStatus var1);

   boolean isPolicyExecutionAttempted();

   void setPolicyExecutionAttempted(boolean var1);

   @Nullable
   DebugContext getDebugContext();

   void setDebugContext(@Nullable DebugContext var1);

   OtelContext getOtelContext();

   void setOtelContext(OtelContext var1);

   void setAuditContext(@Nullable AuditContext var1);

   @Nullable
   AuditContext getAuditContext();

   void runOnClose(Runnable var1);

   void runOnCloseFirst(Runnable var1);

   @Override
   void close();

   boolean isOverwriteResponseCookiePath();

   void setOverwriteResponseCookiePath(boolean var1);

   boolean isOverwriteResponseCookieDomain();

   void setOverwriteResponseCookieDomain(boolean var1);

   boolean isAuthorizedRequest();

   boolean isCompletedRequest();

   final class AssertionResult {
      private final Assertion a;
      private final AssertionStatus b;
      private final Object c;

      protected AssertionResult(Assertion var1, AssertionStatus var2, Object var3) {
         this.a = var1;
         this.b = var2;
         this.c = var3;
      }

      public Assertion getAssertion() {
         return this.a;
      }

      public AssertionStatus getStatus() {
         return this.b;
      }

      public Object getDetailsKey() {
         return this.c;
      }
   }
}
