namespace ZB.MOM.WW.LmxProxy.Host.Domain
{
    /// <summary>
    ///     OPC quality codes mapped to domain-level values.
    ///     The byte value matches the low-order byte of the OPC DA quality code,
    ///     enabling direct round-trip between the domain enum and the wire OPC DA byte.
    /// </summary>
    public enum Quality : byte
    {
        // ─────────────── Bad family (0-31) ───────────────
        /// <summary>0x00 - Bad [Non-Specific]</summary>
        Bad = 0,

        /// <summary>0x01 - Unknown quality value</summary>
        Unknown = 1,

        /// <summary>0x04 - Bad [Configuration Error]</summary>
        Bad_ConfigError = 4,

        /// <summary>0x08 - Bad [Not Connected]</summary>
        Bad_NotConnected = 8,

        /// <summary>0x0C - Bad [Device Failure]</summary>
        Bad_DeviceFailure = 12,

        /// <summary>0x10 - Bad [Sensor Failure]</summary>
        Bad_SensorFailure = 16,

        /// <summary>0x14 - Bad [Last Known Value]</summary>
        Bad_LastKnownValue = 20,

        /// <summary>0x18 - Bad [Communication Failure]</summary>
        Bad_CommFailure = 24,

        /// <summary>0x1C - Bad [Out of Service]</summary>
        Bad_OutOfService = 28,

        /// <summary>0x20 - Bad [Waiting for Initial Data]</summary>
        Bad_WaitingForInitialData = 32,

        // ──────────── Uncertain family (64-95) ───────────
        /// <summary>0x40 - Uncertain [Non-Specific]</summary>
        Uncertain = 64,

        /// <summary>0x41 - Uncertain [Non-Specific] (Low Limited)</summary>
        Uncertain_LowLimited = 65,

        /// <summary>0x42 - Uncertain [Non-Specific] (High Limited)</summary>
        Uncertain_HighLimited = 66,

        /// <summary>0x43 - Uncertain [Non-Specific] (Constant)</summary>
        Uncertain_Constant = 67,

        /// <summary>0x44 - Uncertain [Last Usable]</summary>
        Uncertain_LastUsable = 68,

        /// <summary>0x45 - Uncertain [Last Usable] (Low Limited)</summary>
        Uncertain_LastUsable_LL = 69,

        /// <summary>0x46 - Uncertain [Last Usable] (High Limited)</summary>
        Uncertain_LastUsable_HL = 70,

        /// <summary>0x47 - Uncertain [Last Usable] (Constant)</summary>
        Uncertain_LastUsable_Cnst = 71,

        /// <summary>0x50 - Uncertain [Sensor Not Accurate]</summary>
        Uncertain_SensorNotAcc = 80,

        /// <summary>0x51 - Uncertain [Sensor Not Accurate] (Low Limited)</summary>
        Uncertain_SensorNotAcc_LL = 81,

        /// <summary>0x52 - Uncertain [Sensor Not Accurate] (High Limited)</summary>
        Uncertain_SensorNotAcc_HL = 82,

        /// <summary>0x53 - Uncertain [Sensor Not Accurate] (Constant)</summary>
        Uncertain_SensorNotAcc_C = 83,

        /// <summary>0x54 - Uncertain [EU Exceeded]</summary>
        Uncertain_EuExceeded = 84,

        /// <summary>0x55 - Uncertain [EU Exceeded] (Low Limited)</summary>
        Uncertain_EuExceeded_LL = 85,

        /// <summary>0x56 - Uncertain [EU Exceeded] (High Limited)</summary>
        Uncertain_EuExceeded_HL = 86,

        /// <summary>0x57 - Uncertain [EU Exceeded] (Constant)</summary>
        Uncertain_EuExceeded_C = 87,

        /// <summary>0x58 - Uncertain [Sub-Normal]</summary>
        Uncertain_SubNormal = 88,

        /// <summary>0x59 - Uncertain [Sub-Normal] (Low Limited)</summary>
        Uncertain_SubNormal_LL = 89,

        /// <summary>0x5A - Uncertain [Sub-Normal] (High Limited)</summary>
        Uncertain_SubNormal_HL = 90,

        /// <summary>0x5B - Uncertain [Sub-Normal] (Constant)</summary>
        Uncertain_SubNormal_C = 91,

        // ─────────────── Good family (192-219) ────────────
        /// <summary>0xC0 - Good [Non-Specific]</summary>
        Good = 192,

        /// <summary>0xC1 - Good [Non-Specific] (Low Limited)</summary>
        Good_LowLimited = 193,

        /// <summary>0xC2 - Good [Non-Specific] (High Limited)</summary>
        Good_HighLimited = 194,

        /// <summary>0xC3 - Good [Non-Specific] (Constant)</summary>
        Good_Constant = 195,

        /// <summary>0xD8 - Good [Local Override]</summary>
        Good_LocalOverride = 216,

        /// <summary>0xD9 - Good [Local Override] (Low Limited)</summary>
        Good_LocalOverride_LL = 217,

        /// <summary>0xDA - Good [Local Override] (High Limited)</summary>
        Good_LocalOverride_HL = 218,

        /// <summary>0xDB - Good [Local Override] (Constant)</summary>
        Good_LocalOverride_C = 219
    }
}
