using ColaFlow.Modules.Mcp.Contracts.JsonRpc;

namespace ColaFlow.Modules.Mcp.Domain.Exceptions;

/// <summary>
/// Exception thrown when invalid JSON is received by the server
/// Maps to JSON-RPC error code -32700 (ParseError)
/// </summary>
public class McpParseException : McpException
{
    /// <summary>
    /// Initializes a new instance of the <see cref="McpParseException"/> class
    /// </summary>
    /// <param name="message">Error message</param>
    /// <param name="innerException">Inner exception (optional)</param>
    public McpParseException(string message = "Parse error", Exception? innerException = null)
        : base(JsonRpcErrorCode.ParseError, message, null, innerException)
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="McpParseException"/> class with additional error data
    /// </summary>
    /// <param name="message">Error message</param>
    /// <param name="errorData">Additional error data</param>
    /// <param name="innerException">Inner exception (optional)</param>
    public McpParseException(string message, object? errorData, Exception? innerException = null)
        : base(JsonRpcErrorCode.ParseError, message, errorData, innerException)
    {
    }
}
