using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Uigenx.Protocol
{
public enum UgxActionSource
{
[EnumMember(Value = "ui")] Ui,
[EnumMember(Value = "code")] Code,
}
public sealed class UgxDataSchemaRequest
{
public string RequestId { get; set; } = string.Empty;
/// Reflect one type; omit to reflect every [UgxDataSource] class in the project.
public string Type { get; set; }
}
public sealed class UgxDataSchemaField
{
public string Path { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
public bool Writable { get; set; }
}
public sealed class UgxDataSchemaSource
{
public string Name { get; set; } = string.Empty;
public string TypeName { get; set; } = string.Empty;
public List Fields { get; set; } = new List();
}
public sealed class UgxDataSchemaAction
{
public string Name { get; set; } = string.Empty;
public Dictionary Payload { get; set; } = new Dictionary();
}
public sealed class UgxDataSchemaResult
{
public string RequestId { get; set; }
public List Sources { get; set; } = new List();
public List Actions { get; set; } = new List();
}
public sealed class UgxDataSubscribe
{
public string Session { get; set; } = string.Empty;
public List Paths { get; set; } = new List();
public double Hz { get; set; } = 20d;
}
public sealed class UgxDataUnsubscribe
{
public string Session { get; set; } = string.Empty;
}
/// One changed path. `V` is string, number, bool or null.
public sealed class UgxDataChange
{
public string Path { get; set; } = string.Empty;
[Newtonsoft.Json.JsonProperty("v")] public object V { get; set; }
}
public sealed class UgxDataDelta
{
public string Session { get; set; } = string.Empty;
public int Seq { get; set; }
public List Changes { get; set; } = new List();
}
public sealed class UgxDataSnapshot
{
public string Session { get; set; } = string.Empty;
public int Seq { get; set; }
public Dictionary Values { get; set; } = new Dictionary();
}
public sealed class UgxDataSet
{
public string Path { get; set; } = string.Empty;
public object Value { get; set; }
}
public sealed class UgxActionEmit
{
public string Action { get; set; } = string.Empty;
public Dictionary Payload { get; set; } = new Dictionary();
}
public sealed class UgxActionFired
{
public string Action { get; set; } = string.Empty;
public Dictionary Payload { get; set; } = new Dictionary();
public string Screen { get; set; }
public string NodeId { get; set; }
public UgxActionSource Source { get; set; } = UgxActionSource.Ui;
}
}