001/*
002 * Copyright 2022-2026 Revetware LLC.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package com.soklet;
018
019import org.jspecify.annotations.NonNull;
020
021import javax.annotation.concurrent.ThreadSafe;
022import java.time.Instant;
023import java.util.Set;
024
025/**
026 * Immutable HTTP admission context for GET delivery and DELETE cleanup at
027 * session-enabled {@code 2025-06-18} and {@code 2025-11-25} endpoints.
028 * Soklet's {@code 2026-07-28} implementation does not use this context.
029 * <p>
030 * These HTTP operations have no JSON-RPC method or request ID. The original
031 * HTTP method remains available through {@link Request#getHttpMethod()}.
032 * Reauthorization retains the original immutable GET request as historical
033 * credential input; the application must evaluate current authority again.
034 *
035 * @author <a href="https://www.revetkn.com">Mark Allen</a>
036 */
037@ThreadSafe
038public interface McpSessionTransportAdmissionContext {
039        /** @return the original immutable Soklet HTTP request */
040        @NonNull Request getRequest();
041
042        /** @return the selected session-enabled MCP endpoint */
043        @NonNull McpEndpoint getEndpoint();
044
045        /** @return the explicitly selected eligible MCP protocol revision */
046        @NonNull McpProtocolVersion getProtocolVersion();
047
048        /**
049         * Returns the effective notification families offered by this endpoint at
050         * the selected revision, including eligible localization invalidations.
051         * An accepted decision may select a subset of these families. DELETE has
052         * no delivery selection and always supplies the empty set.
053         *
054         * @return immutable offered notification-family set
055         */
056        @NonNull Set<@NonNull McpSubscriptionNotificationType> getNotificationTypes();
057
058        /** @return whether an existing GET authorization is being reevaluated */
059        @NonNull Boolean isReauthorization();
060
061        /**
062         * Returns the queue-inclusive deadline for this callback. This bounds
063         * application execution; it is distinct from the accepted grant's expiry.
064         * A callback that ignores cancellation retains its physical execution
065         * reservation until it exits.
066         *
067         * @return callback execution deadline
068         */
069        @NonNull Instant getDeadline();
070}