package com.lingniu.ingest.session;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.time.Duration;
import java.util.concurrent.CompletableFuture;

/**
 * 占位命令调度器：返回 {@link UnsupportedOperationException}，
 * 待 command-gateway 与协议模块的下行通道打通后替换为真实实现。
 */
public final class NoopCommandDispatcher implements CommandDispatcher {

    private static final Logger log = LoggerFactory.getLogger(NoopCommandDispatcher.class);

    @Override
    public CompletableFuture<Void> notify(String sessionId, Object command) {
        log.warn("[noop] notify sessionId={} command={} dropped", sessionId, command);
        return CompletableFuture.failedFuture(new UnsupportedOperationException(
                "CommandDispatcher not yet implemented; configure a real one in protocol module."));
    }

    @Override
    public <T> CompletableFuture<T> request(String sessionId, Object command, Class<T> responseType, Duration timeout) {
        log.warn("[noop] request sessionId={} command={} responseType={} dropped",
                sessionId, command, responseType.getSimpleName());
        return CompletableFuture.failedFuture(new UnsupportedOperationException(
                "CommandDispatcher not yet implemented; configure a real one in protocol module."));
    }
}
