using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
namespace ZB.MOM.WW.ScadaBridge.Communication.Grpc;
///
/// Maps to/from the wire string carried in the
/// AlarmStateUpdate.shelve_state proto field. The wire form is the enum
/// member name; an empty or unrecognized string parses back to
/// (the safe default).
///
public static class AlarmShelveStateCodec
{
/// Returns the wire string for a shelve state (the enum member name).
public static string ToWire(AlarmShelveState state) => state.ToString();
/// Parses a wire string back to a shelve state; defaults to .
public static AlarmShelveState Parse(string? wire) =>
Enum.TryParse(wire, ignoreCase: true, out var state)
? state
: AlarmShelveState.Unshelved;
}