using ECMJobRunner.Application.Common.Constants;
using System.Text.RegularExpressions;
namespace ECMJobRunner.Application.Common.Options
{
///
/// Configuration options for DEX job execution
///
public class DexJobOptions
{
///
/// Error handling options for DEX job operations
///
public record DexJobErrorHandlingOptions
{
///
/// Error handling options for SQL query execution
///
public record SqlQueryErrorHandlingOptions
{
///
/// Action to take when query execution fails
///
public ErrorAction OnExecution { get; set; } = ErrorAction.Stop;
///
/// Action to take when query is null or whitespace
///
public ErrorAction IfNullOrWhiteSpace { get; set; } = ErrorAction.Ignore;
///
/// Action to take when query returns unexpected result
///
public ErrorAction OnUnexpectedResult { get; set; } = ErrorAction.Stop;
}
///
/// Error handling options for HTTP requests
///
public record HttpRequestErrorHandlingOptions
{
///
/// Action to take when HTTP request fails
///
public ErrorAction OnSending { get; set; } = ErrorAction.Stop;
}
///
/// Error handling for main SQL query
///
public SqlQueryErrorHandlingOptions MainQuery { get; set; } = new();
///
/// Error handling for check SQL query
///
public SqlQueryErrorHandlingOptions CheckQuery { get; set; } = new();
///
/// Error handling for ReC HTTP request
///
public HttpRequestErrorHandlingOptions ReCRequest { get; set; } = new();
}
///
/// Error handling configuration
///
public DexJobErrorHandlingOptions Error { get; set; } = new();
///
/// Placeholder configuration for dynamic value replacement
///
public record PlaceHolderOptions
{
///
/// Configuration for a single placeholder
///
public record PlaceHolder
{
///
/// Regex pattern to match the placeholder
///
public string Pattern { get; set; } = null!;
///
/// Regex options for pattern matching
///
public RegexOptions RegexOptions { get; set; } = RegexOptions.IgnoreCase;
}
///
/// BatchId placeholder configuration
///
public PlaceHolder BatchId { get; set; } = new()
{
Pattern = "#INT#BATCH_ID",
RegexOptions = RegexOptions.IgnoreCase
};
}
///
/// Placeholder configuration
///
public PlaceHolderOptions Placeholders { get; set; } = new();
}
}