25 lines
532 B
C#
25 lines
532 B
C#
using System.Text.Json.Nodes;
|
|
|
|
namespace InnovEnergy.Lib.StatusApi;
|
|
|
|
public record DcDevice : IDcDevice
|
|
{
|
|
public IPhase Dc { get; init; }
|
|
public DeviceType Type { get; init; }
|
|
public String? Name { get; init; }
|
|
|
|
|
|
public JsonNode ToJson()
|
|
{
|
|
var jsonDict = new Dictionary<String, JsonNode>();
|
|
|
|
jsonDict[nameof(Type)] = Type.ToString()!;
|
|
|
|
if (Name is not null)
|
|
jsonDict[nameof(Name)] = Name!;
|
|
|
|
|
|
return new JsonObject(jsonDict!);
|
|
}
|
|
|
|
} |