using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Sql.Common.Tests;
/// The SqlServer integration fixture's time base and tag A, as plain values (no database).
internal static class Fixture
{
/// 2026-10-09 08:00:00.1234567 UTC — deliberately not millisecond-aligned (same as ReadTestDb.T0).
public static readonly DateTime T0 = new DateTime(2026, 10, 9, 8, 0, 0, DateTimeKind.Utc).AddTicks(1_234_567);
public const uint Good = 0x00000000u;
public const uint Bad = 0x80000000u;
public const uint BadNoCommunication = 0x80310000u;
public const uint Uncertain = 0x40000000u;
// Hand-computed literals, copied from the SqlServer integration tests.
public const uint GoodInterpolated = 0x00000402u;
public const uint UncertainInterpolated = 0x40A40402u;
public const uint GoodCalc = 0x00000401u;
public const uint UncertainCalc = 0x40A40401u;
public const uint NoDataCalc = 0x809B0401u;
public const uint InvalidInputsCalc = 0x80D60401u;
public static DateTime At(double seconds) => T0.AddTicks((long)(seconds * TimeSpan.TicksPerSecond));
public static StoredSample S(double seconds, HistorianValue v, uint status) => new(At(seconds), v, status);
/// Tag A: +0=10, +10=20, +20=Bad(30), +30=40, +40=50 (Double).
public static readonly StoredSample[] A =
[
S(0, HistorianValue.FromDouble(10), Good),
S(10, HistorianValue.FromDouble(20), Good),
S(20, HistorianValue.FromDouble(30), Bad),
S(30, HistorianValue.FromDouble(40), Good),
S(40, HistorianValue.FromDouble(50), Good),
];
}