using ZB.MOM.WW.OtOpcUa.AdminUI.Uns.TagEditors;
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Drivers.DeviceForms;
///
/// Device model for the AVEVA Galaxy driver. Galaxy connects to a SINGLE mxaccessgw gateway configured
/// on the driver (nested Gateway/MxAccess records) — there is no flat per-device connection
/// endpoint to author, so this model authors no endpoint keys. It simply round-trips the DeviceConfig
/// JSON verbatim (preserving any keys) so the device row stays valid. (Flagged: Galaxy has no v3
/// endpoint→DeviceConfig split; its connection lives on the driver config.)
///
public sealed class GalaxyDeviceModel
{
private System.Text.Json.Nodes.JsonObject _bag = new();
/// Loads a model from a DeviceConfig JSON string, retaining every original key.
/// The raw DeviceConfig JSON string, or null for a new/empty device.
/// The populated .
public static GalaxyDeviceModel FromJson(string? json)
=> new() { _bag = TagConfigJson.ParseOrNew(json) };
/// Serializes the (preserved) DeviceConfig back to a JSON string.
/// The serialised DeviceConfig JSON string.
public string ToJson() => TagConfigJson.Serialize(_bag);
/// Validation hook; Galaxy device rows carry no endpoint, so always valid.
/// null — no per-device endpoint to validate.
public string? Validate() => null;
}