using IceImportDAL.DTO.IceImportPipeline; namespace IceImportBLL.FieldResolvers; // ValueType = 1 (Fixed). Legacy overloads IceMapDetailsSourceFieldName to also hold the literal // fixed value when ValueType is Fixed rather than Source. public class FixedValueResolver : IIceFieldValueResolver { public int ValueType => 1; public Task ResolveAsync(FieldResolutionContext ctx, CancellationToken ct) { var raw = ctx.DetailConfig.IceMapDetailsSourceFieldName; if (!IceImportTypeCoercion.TryCoerce(raw, ctx.DetailConfig.DestinationMemberDataType, out var value)) { var warning = new IceImportFieldErrorDTO { RowNumber = ctx.RowNumber, EntityCode = ctx.DetailConfig.EntityCode ?? string.Empty, FieldName = ctx.DetailConfig.DestinationMemberMemberName ?? string.Empty, Message = $"Fixed value '{raw}' could not be converted to the destination field's declared type.", Severity = IceImportSeverity.Warning }; return Task.FromResult(FieldResolutionResult.WithWarning(null, warning)); } return Task.FromResult(FieldResolutionResult.Ok(value)); } }