#pragma once

#include "MCPTypes.hpp"
#include <nlohmann/json.hpp>
#include <string>
#include <memory>

namespace celuna::mcp {

using json = nlohmann::json;

/**
 * @brief Abstract transport interface for MCP communication
 */
class IMCPTransport {
public:
    virtual ~IMCPTransport() = default;

    /**
     * @brief Start the transport (connect/spawn process)
     * @return true if successful
     */
    virtual bool start() = 0;

    /**
     * @brief Stop the transport
     */
    virtual void stop() = 0;

    /**
     * @brief Check if transport is running
     */
    virtual bool isRunning() const = 0;

    /**
     * @brief Send a JSON-RPC request and wait for response
     * @param request The request to send
     * @param timeoutMs Timeout in milliseconds
     * @return The response
     */
    virtual JsonRpcResponse sendRequest(const JsonRpcRequest& request, int timeoutMs = 30000) = 0;

    /**
     * @brief Send a notification (no response expected)
     * @param method Method name
     * @param params Parameters
     */
    virtual void sendNotification(const std::string& method, const json& params) = 0;
};

} // namespace celuna::mcp
