using ZB.MOM.WW.MxGateway.Contracts.Proto;

namespace ZB.MOM.WW.MxGateway.Client;

/// <summary>Exception thrown when the worker process is unavailable or fails to process a command.</summary>
public sealed class MxGatewayWorkerException : MxGatewayException
{
    /// <summary>Initializes a new instance with the given details.</summary>
    /// <param name="message">The error message describing the worker failure.</param>
    /// <param name="sessionId">The session ID, if available.</param>
    /// <param name="correlationId">The correlation ID for tracing, if available.</param>
    /// <param name="protocolStatus">The protocol status details, if available.</param>
    /// <param name="hResult">The HResult code, if available.</param>
    /// <param name="statuses">The MXAccess statuses, if available.</param>
    /// <param name="innerException">The underlying exception, if any.</param>
    public MxGatewayWorkerException(
        string message,
        string? sessionId = null,
        string? correlationId = null,
        ProtocolStatus? protocolStatus = null,
        int? hResult = null,
        IReadOnlyList<MxStatusProxy>? statuses = null,
        Exception? innerException = null)
        : base(
            message,
            sessionId,
            correlationId,
            protocolStatus,
            hResult,
            statuses ?? [],
            innerException)
    {
    }
}
