namespace Mbproxy.Bcd;
/// Discriminates the class of validation failure in a resolved BCD tag list.
public enum BcdValidationError
{
/// Two or more entries share the same Modbus register address.
DuplicateAddress,
///
/// A 32-bit entry's high register (Address+1) collides with another entry's address.
///
OverlappingHighRegister,
/// An entry has a Width that is not 16 or 32.
InvalidWidth,
}
/// A hard validation failure that prevents the map from being used.
public sealed record BcdError(BcdValidationError Kind, string Message, ushort? Address);
/// A non-fatal advisory that rides along with the map.
public sealed record BcdWarning(string Message, ushort? Address);
///
/// Result of a call.
/// When is non-empty the map is partial (only valid entries are included).
/// Callers should treat any error as a fatal configuration problem at startup.
///
public sealed record ValidationResult(
BcdTagMap Map,
IReadOnlyList Errors,
IReadOnlyList Warnings);