using FrameworkDAL.DTO.EIPConversation; using FrameworkDAL.Query.EIPConversation.EIPRestActionCfg; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using Microsoft.Extensions.Logging; using System; using System.Threading; using System.Threading.Tasks; namespace FrameworkDAL.CustomCode.EIPConversation.EIPRestActionCfg { public class EIPRestActionCfgDAL : IEIPRestActionCfgDAL { private readonly IQueryExecutor _qe; private readonly ILogger _logger; public EIPRestActionCfgDAL(IQueryExecutor qe, ILogger logger) { _qe = qe ?? throw new ArgumentNullException(nameof(qe)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); } public async Task GetByActionCodeAsync( string actionCode, LoginDTO loginDTO, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(actionCode)) throw new ArgumentException("ActionCode is required.", nameof(actionCode)); _logger.LogInformation("EIPRestActionCfgDAL | GetByActionCode={Code}", actionCode); return await _qe.QuerySingleAsync( loginDTO, EIPRestActionCfgQB.GET_BY_ACTIONCODE, new { ActionCode = actionCode.Trim().ToUpperInvariant() }, cancellationToken: cancellationToken).ConfigureAwait(false); } } }