package rdp

// RDPConfig holds the parameters needed to establish an RDP connection.
type RDPConfig struct {
	Hostname   string // Remote host address
	Port       int    // RDP port (default 3389)
	Username   string
	Password   string
	Domain     string // Windows domain (optional)
	Width      int    // Desktop width in pixels
	Height     int    // Desktop height in pixels
	ColorDepth int    // 16, 24, or 32
	Security   string // "nla", "tls", or "rdp"
}

// FrameUpdate represents a partial screen update from the RDP server.
// The data is in RGBA format (4 bytes per pixel).
type FrameUpdate struct {
	X      int    // top-left X of the updated region
	Y      int    // top-left Y of the updated region
	Width  int    // width of the updated region in pixels
	Height int    // height of the updated region in pixels
	Data   []byte // RGBA pixel data, len = Width * Height * 4
}

// RDPBackend abstracts the FreeRDP implementation so that a mock can be
// used during development on platforms where FreeRDP is not available.
type RDPBackend interface {
	// Connect establishes an RDP session with the given configuration.
	Connect(config RDPConfig) error

	// Disconnect tears down the RDP session.
	Disconnect() error

	// SendMouseEvent sends a mouse event with the given position and flags.
	// Flags use the RDP mouse event flag constants (MouseFlag*).
	SendMouseEvent(x, y int, flags uint32) error

	// SendKeyEvent sends a keyboard event for the given RDP scancode.
	// pressed=true for key down, false for key up.
	SendKeyEvent(scancode uint32, pressed bool) error

	// SendClipboard sends clipboard text to the remote session.
	SendClipboard(data string) error

	// GetFrame returns the current full-frame RGBA pixel buffer.
	// The returned slice length is Width * Height * 4.
	GetFrame() ([]byte, error)

	// IsConnected reports whether the backend has an active connection.
	IsConnected() bool
}
