namespace ZB.MOM.WW.LmxProxy.Client.Domain;

/// <summary>
/// OPC-style quality codes for SCADA data values.
/// Based on OPC DA quality encoding as a single byte:
/// bits 7–6 = major (00=Bad, 01=Uncertain, 11=Good),
/// bits 5–2 = substatus, bits 1–0 = limit (00=None, 01=Low, 10=High, 11=Constant).
/// </summary>
public enum Quality : byte
{
	/// <summary>Bad – non-specific.</summary>
	Bad = 0,

	/// <summary>Bad – configuration error in the server.</summary>
	Bad_ConfigError = 4,

	/// <summary>Bad – input source is not connected.</summary>
	Bad_NotConnected = 8,

	/// <summary>Bad – device failure detected.</summary>
	Bad_DeviceFailure = 12,

	/// <summary>Bad – sensor failure detected.</summary>
	Bad_SensorFailure = 16,

	/// <summary>Bad – last known value (communication lost, value stale).</summary>
	Bad_LastKnownValue = 20,

	/// <summary>Bad – communication failure.</summary>
	Bad_CommFailure = 24,

	/// <summary>Bad – item is out of service.</summary>
	Bad_OutOfService = 28,

	/// <summary>Uncertain – non-specific.</summary>
	Uncertain = 64,

	/// <summary>Uncertain – non-specific, low limited.</summary>
	Uncertain_LowLimited = 65,

	/// <summary>Uncertain – non-specific, high limited.</summary>
	Uncertain_HighLimited = 66,

	/// <summary>Uncertain – non-specific, constant.</summary>
	Uncertain_Constant = 67,

	/// <summary>Uncertain – last usable value.</summary>
	Uncertain_LastUsable = 68,

	/// <summary>Uncertain – last usable value, low limited.</summary>
	Uncertain_LastUsable_LL = 69,

	/// <summary>Uncertain – last usable value, high limited.</summary>
	Uncertain_LastUsable_HL = 70,

	/// <summary>Uncertain – last usable value, constant.</summary>
	Uncertain_LastUsable_Cnst = 71,

	/// <summary>Uncertain – sensor not accurate.</summary>
	Uncertain_SensorNotAcc = 80,

	/// <summary>Uncertain – sensor not accurate, low limited.</summary>
	Uncertain_SensorNotAcc_LL = 81,

	/// <summary>Uncertain – sensor not accurate, high limited.</summary>
	Uncertain_SensorNotAcc_HL = 82,

	/// <summary>Uncertain – sensor not accurate, constant.</summary>
	Uncertain_SensorNotAcc_C = 83,

	/// <summary>Uncertain – engineering units exceeded.</summary>
	Uncertain_EuExceeded = 84,

	/// <summary>Uncertain – engineering units exceeded, low limited.</summary>
	Uncertain_EuExceeded_LL = 85,

	/// <summary>Uncertain – engineering units exceeded, high limited.</summary>
	Uncertain_EuExceeded_HL = 86,

	/// <summary>Uncertain – engineering units exceeded, constant.</summary>
	Uncertain_EuExceeded_C = 87,

	/// <summary>Uncertain – sub-normal operating conditions.</summary>
	Uncertain_SubNormal = 88,

	/// <summary>Uncertain – sub-normal, low limited.</summary>
	Uncertain_SubNormal_LL = 89,

	/// <summary>Uncertain – sub-normal, high limited.</summary>
	Uncertain_SubNormal_HL = 90,

	/// <summary>Uncertain – sub-normal, constant.</summary>
	Uncertain_SubNormal_C = 91,

	/// <summary>Good – non-specific.</summary>
	Good = 192,

	/// <summary>Good – low limited.</summary>
	Good_LowLimited = 193,

	/// <summary>Good – high limited.</summary>
	Good_HighLimited = 194,

	/// <summary>Good – constant.</summary>
	Good_Constant = 195,

	/// <summary>Good – local override active.</summary>
	Good_LocalOverride = 216,

	/// <summary>Good – local override active, low limited.</summary>
	Good_LocalOverride_LL = 217,

	/// <summary>Good – local override active, high limited.</summary>
	Good_LocalOverride_HL = 218,

	/// <summary>Good – local override active, constant.</summary>
	Good_LocalOverride_C = 219
}
