// Code generated by ndpgen. DO NOT EDIT.
//
// This file provides stub implementations for non-WASM platforms.
// It allows Go plugins to compile and run tests outside of WASM,
// but the actual functionality is only available in WASM builds.
//
//go:build !wasip1

package websocket

// OnBinaryMessageRequest is the request provided when a binary message is received.
type OnBinaryMessageRequest struct {
	// ConnectionID is the unique identifier for the WebSocket connection that received the message.
	ConnectionID string `json:"connectionId"`
	// Data is the binary data received from the WebSocket, encoded as base64.
	Data []byte `json:"data"`
}

// OnCloseRequest is the request provided when a WebSocket connection is closed.
type OnCloseRequest struct {
	// ConnectionID is the unique identifier for the WebSocket connection that was closed.
	ConnectionID string `json:"connectionId"`
	// Code is the WebSocket close status code (e.g., 1000 for normal closure,
	// 1001 for going away, 1006 for abnormal closure).
	Code int32 `json:"code"`
	// Reason is the human-readable reason for the connection closure, if provided.
	Reason string `json:"reason"`
}

// OnErrorRequest is the request provided when an error occurs on a WebSocket connection.
type OnErrorRequest struct {
	// ConnectionID is the unique identifier for the WebSocket connection where the error occurred.
	ConnectionID string `json:"connectionId"`
	// Error is the error message describing what went wrong.
	Error string `json:"error"`
}

// OnTextMessageRequest is the request provided when a text message is received.
type OnTextMessageRequest struct {
	// ConnectionID is the unique identifier for the WebSocket connection that received the message.
	ConnectionID string `json:"connectionId"`
	// Message is the text message content received from the WebSocket.
	Message string `json:"message"`
}

// WebSocket is the marker interface for websocket plugins.
// Implement one or more of the provider interfaces below.
// WebSocketCallback provides WebSocket message handling.
// This capability allows plugins to receive callbacks for WebSocket events
// such as text messages, binary messages, errors, and connection closures.
// Plugins that use the WebSocket host service must implement this capability
// to handle incoming events.
type WebSocket interface{}

// TextMessageProvider provides the OnTextMessage function.
type TextMessageProvider interface {
	OnTextMessage(OnTextMessageRequest) error
}

// BinaryMessageProvider provides the OnBinaryMessage function.
type BinaryMessageProvider interface {
	OnBinaryMessage(OnBinaryMessageRequest) error
}

// ErrorProvider provides the OnError function.
type ErrorProvider interface {
	OnError(OnErrorRequest) error
}

// CloseProvider provides the OnClose function.
type CloseProvider interface {
	OnClose(OnCloseRequest) error
}

// NotImplementedCode is the standard return code for unimplemented functions.
const NotImplementedCode int32 = -2

// Register is a no-op on non-WASM platforms.
// This stub allows code to compile outside of WASM.
func Register(_ WebSocket) {}
