// Copyright (C) 2026 SharpEmu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
namespace SharpEmu.Debugger.Protocol;
///
/// The reply to a : either success with an optional
/// data payload, or a failure with a human-readable message.
///
public sealed class DebugResponse
{
private DebugResponse(bool ok, string? command, IReadOnlyDictionary? data, string? error)
{
Ok = ok;
Command = command;
Data = data;
Error = error;
}
public bool Ok { get; }
/// Echoes the command the reply answers, when known.
public string? Command { get; }
public IReadOnlyDictionary? Data { get; }
public string? Error { get; }
public static DebugResponse Success(string command, IReadOnlyDictionary? data = null)
=> new(ok: true, command, data, error: null);
public static DebugResponse Failure(string command, string error)
=> new(ok: false, command, data: null, error);
}