using System;
namespace ECMJobRunner.Application.Common.Exceptions
{
///
/// Exception for HTTP client-related job failures (e.g., ReC API calls, REST requests)
/// Extends JobException with client library and method context
///
///
/// Initializes a new instance of JobHttpException with HTTP client context
///
/// Identifier of the profile associated with the job
/// Name of the job that failed (e.g., "ReC Request", "API Call")
/// Name of the process/stage being executed
/// Unique batch identifier for tracking
/// Human-readable reason for the failure (nullable)
/// Name of the HTTP client library used (e.g., "ReC.Client", "HttpClient") (nullable)
/// Name of the client method that failed (e.g., "ExecuteAsync", "PostAsync") (nullable)
/// The underlying exception that caused the failure (nullable)
///
/// Use this exception for HTTP-related failures such as:
/// - ReC API request failures
/// - REST API communication errors
/// - HTTP client timeout/network issues
/// - Authentication/authorization failures
///
public class JobHttpException(long profileId, string jobName, string processName, string batchId, string? reason, string? clientLibrary, string? clientMethod, Exception? innerException)
: JobException(profileId, jobName, processName, batchId, reason, innerException, ("Client Library", clientLibrary, true), ("Client Method", clientMethod, true))
{
///
/// Gets the name of the HTTP client library that was used (e.g., "ReC.Client", "HttpClient")
///
public string? ClientLibrary { get; } = clientLibrary;
///
/// Gets the name of the client method that failed (e.g., "ExecuteAsync", "PostAsync")
///
public string? ClientMethod { get; } = clientMethod;
}
}