namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Sql.Common;
/// Part 4 §7.39 historian info bits OR-ed onto a status code.
public static class HistorianInfoBits
{
/// InfoType = DataValue.
public const uint InfoTypeDataValue = 0x00000400u;
/// The value was produced by an aggregate calculation.
public const uint HistorianCalculated = 0x1u;
/// The value was interpolated.
public const uint HistorianInterpolated = 0x2u;
///
/// Partial (Part 4 §7.39 / Opc.Ua.AggregateBits.Partial): the calculated value covers an interval shorter
/// than the processing interval (the truncated last interval of a processed read).
///
public const uint HistorianPartial = 0x4u;
///
/// Marks as a Calculated data value. Any historian bits the status already carries
/// (e.g. a stored Interpolated sample) are cleared first, so the result is never both.
///
/// Base status code.
/// Status with InfoType and Calculated bits set.
public static uint WithCalculated(uint status) =>
(status & ~StatusBits.HistorianBitsMask) | InfoTypeDataValue | HistorianCalculated;
///
/// Marks as an Interpolated data value. Any historian bits the status already
/// carries (e.g. a stored Calculated sample) are cleared first, so the result is never both.
///
/// Base status code.
/// Status with InfoType and Interpolated bits set.
public static uint WithInterpolated(uint status) =>
(status & ~StatusBits.HistorianBitsMask) | InfoTypeDataValue | HistorianInterpolated;
}