namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;

/// <summary>
///     Single source of truth for the driver-type identifier strings the runtime
///     dispatches on. Each constant's <b>value</b> is the exact <c>DriverTypeName</c>
///     that the corresponding driver factory registers under in the process
///     <c>DriverFactoryRegistry</c> — the string the deploy pipeline stores in
///     <c>DriverInstance.DriverType</c> and every dispatch map keys by.
/// </summary>
/// <remarks>
///     <para>
///     Historically several dispatch maps hand-authored these strings and drifted from
///     the authoritative factory names (e.g. <c>"TwinCat"</c> vs the real
///     <c>"TwinCAT"</c>, <c>"Focas"</c> vs <c>"FOCAS"</c>). Consumers should reference
///     these constants instead of literals so the drift can never recur.
///     </para>
///     <para>
///     The reflection guard test
///     (<c>DriverTypeNamesGuardTests</c>) asserts bidirectional parity between these
///     constants and the set the driver factories actually register, so a rename on
///     either side breaks the build's test gate. Only constants for
///     <b>currently-registered</b> factories belong here — a driver adds its own constant
///     when its factory is wired in. (This used to name Calculation as the example of a
///     not-yet-registered driver; it registers in <c>DriverFactoryBootstrap</c> like the rest.)
///     </para>
/// </remarks>
public static class DriverTypeNames
{
    /// <summary>Modbus TCP / RTU-over-TCP driver.</summary>
    public const string Modbus = "Modbus";

    /// <summary>Siemens S7 driver.</summary>
    public const string S7 = "S7";

    /// <summary>Allen-Bradley CIP (ControlLogix / CompactLogix) driver.</summary>
    public const string AbCip = "AbCip";

    /// <summary>Allen-Bradley legacy (PCCC / DF1-over-TCP) driver.</summary>
    public const string AbLegacy = "AbLegacy";

    /// <summary>Beckhoff TwinCAT ADS driver.</summary>
    public const string TwinCAT = "TwinCAT";

    /// <summary>FANUC FOCAS CNC driver.</summary>
    public const string FOCAS = "FOCAS";

    /// <summary>OPC UA client (upstream-server) driver.</summary>
    public const string OpcUaClient = "OpcUaClient";

    /// <summary>AVEVA System Platform (Wonderware) Galaxy driver, via the mxaccessgw gateway.</summary>
    public const string Galaxy = "GalaxyMxGateway";

    /// <summary>Calculation pseudo-driver — tags computed by C# scripts over other tags' live values.</summary>
    public const string Calculation = "Calculation";

    /// <summary>Read-only SQL Server table/view poller — publishes columns as OPC UA variables.</summary>
    public const string Sql = "Sql";
    /// <summary>MQTT / Sparkplug B broker-subscription driver.</summary>
    public const string Mqtt = "Mqtt";

    /// <summary>MTConnect Agent driver — read-only HTTP/XML over an Agent's probe/current/sample surface.</summary>
    public const string MTConnect = "MTConnect";

    /// <summary>
    ///     Every driver-type string declared above, for callers that need to enumerate
    ///     the full set (e.g. validation of an authored <c>DriverType</c>).
    /// </summary>
    public static IReadOnlyCollection<string> All { get; } =
    [
        Modbus,
        S7,
        AbCip,
        AbLegacy,
        TwinCAT,
        FOCAS,
        OpcUaClient,
        Galaxy,
        Calculation,
        Sql,
        Mqtt,
        MTConnect,
    ];
}
