using System.Text.Json.Serialization; namespace Zcbot.WindowsNode; internal sealed record NodeConfig( Uri ServerUrl, Guid NodeId, Guid InstallId, string NodeName, string NodeToken, int HeartbeatSeconds, IReadOnlyList Capabilities); internal sealed record StoredNodeConfig( string ServerUrl, Guid NodeId, Guid InstallId, string NodeName, string ProtectedNodeToken, int HeartbeatSeconds, IReadOnlyList Capabilities); internal sealed record EnrollRequest( [property: JsonPropertyName("enrollment_code")] string EnrollmentCode, [property: JsonPropertyName("node_name")] string NodeName, [property: JsonPropertyName("install_id")] Guid InstallId, [property: JsonPropertyName("node_version")] string NodeVersion, [property: JsonPropertyName("os_version")] string OsVersion, [property: JsonPropertyName("capabilities")] IReadOnlyList Capabilities); internal sealed record EnrollResponse( [property: JsonPropertyName("node_id")] Guid NodeId, [property: JsonPropertyName("node_token")] string NodeToken, [property: JsonPropertyName("heartbeat_seconds")] int HeartbeatSeconds, [property: JsonPropertyName("max_concurrency")] int MaxConcurrency); internal sealed record NodePaths(string RootDirectory, string ConfigPath) { internal static NodePaths ForCurrentMachine() { var root = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Zcbot", "WindowsNode"); return new NodePaths(root, Path.Combine(root, "node.json")); } } internal sealed class NodeConfigurationException(string message) : Exception(message); internal sealed class NodeEndpointException(string message) : Exception(message);