using System.Collections.Generic; using System.Text.Json.Serialization; namespace Jellyfin.Plugin.JellyLMS.Models; /// /// JSON-RPC request for LMS API. /// public class LmsJsonRpcRequest { /// /// Gets or sets the request ID. /// [JsonPropertyName("id")] public int Id { get; set; } = 1; /// /// Gets or sets the method name (always "slim.request"). /// [JsonPropertyName("method")] public string Method { get; set; } = "slim.request"; /// /// Gets or sets the parameters [playerMac, [command, args...]]. /// [JsonPropertyName("params")] public object[] Params { get; set; } = []; } /// /// JSON-RPC response from LMS API. /// /// The result type. public class LmsJsonRpcResponse { /// /// Gets or sets the request ID. /// [JsonPropertyName("id")] public int Id { get; set; } /// /// Gets or sets the result data. /// [JsonPropertyName("result")] public T? Result { get; set; } /// /// Gets or sets any error message. /// [JsonPropertyName("error")] public string? Error { get; set; } } /// /// Player count response. /// public class PlayerCountResult { /// /// Gets or sets the count value. /// [JsonPropertyName("_count")] public int Count { get; set; } } /// /// Players list response. /// public class PlayersListResult { /// /// Gets or sets the player count. /// [JsonPropertyName("count")] public int Count { get; set; } /// /// Gets or sets the list of players. /// [JsonPropertyName("players_loop")] public List Players { get; set; } = []; } /// /// Player info from LMS API. /// public class LmsPlayerInfo { /// /// Gets or sets the player name. /// [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// /// Gets or sets the player ID (MAC address). /// [JsonPropertyName("playerid")] public string PlayerId { get; set; } = string.Empty; /// /// Gets or sets the player IP address. /// [JsonPropertyName("ip")] public string Ip { get; set; } = string.Empty; /// /// Gets or sets whether the player is connected. /// [JsonPropertyName("connected")] public int Connected { get; set; } /// /// Gets or sets the power state. /// [JsonPropertyName("power")] public int Power { get; set; } /// /// Gets or sets the player model. /// [JsonPropertyName("model")] public string Model { get; set; } = string.Empty; /// /// Gets or sets the player model name. /// [JsonPropertyName("modelname")] public string ModelName { get; set; } = string.Empty; } /// /// Player status response. /// public class PlayerStatusResult { /// /// Gets or sets the player name. /// [JsonPropertyName("player_name")] public string PlayerName { get; set; } = string.Empty; /// /// Gets or sets the player connected state. /// [JsonPropertyName("player_connected")] public int PlayerConnected { get; set; } /// /// Gets or sets the power state. /// [JsonPropertyName("power")] public int Power { get; set; } /// /// Gets or sets the playback mode (play, pause, stop). /// [JsonPropertyName("mode")] public string Mode { get; set; } = string.Empty; /// /// Gets or sets the current time position in seconds. /// [JsonPropertyName("time")] public double Time { get; set; } /// /// Gets or sets the mixer volume (0-100). /// [JsonPropertyName("mixer volume")] public int Volume { get; set; } /// /// Gets or sets the total duration in seconds. /// [JsonPropertyName("duration")] public double Duration { get; set; } /// /// Gets or sets the sync master MAC address. /// [JsonPropertyName("sync_master")] public string? SyncMaster { get; set; } /// /// Gets or sets the list of synced player MACs. /// [JsonPropertyName("sync_slaves")] public string? SyncSlaves { get; set; } /// /// Gets or sets the current track title. /// [JsonPropertyName("current_title")] public string? CurrentTitle { get; set; } } /// /// LMS server status. /// public class LmsServerStatus { /// /// Gets or sets the server version. /// public string Version { get; set; } = string.Empty; /// /// Gets or sets the player count. /// public int PlayerCount { get; set; } /// /// Gets or sets whether the server is reachable. /// public bool IsConnected { get; set; } /// /// Gets or sets the last error message. /// public string? LastError { get; set; } } /// /// Sync group information. /// public class SyncGroup { /// /// Gets or sets the master player MAC address. /// public string MasterMac { get; set; } = string.Empty; /// /// Gets or sets the master player name. /// public string MasterName { get; set; } = string.Empty; /// /// Gets or sets the slave player MAC addresses. /// public List SlaveMacs { get; set; } = []; /// /// Gets or sets the slave player names. /// public List SlaveNames { get; set; } = []; /// /// Gets the total number of players in this sync group. /// public int PlayerCount => 1 + SlaveMacs.Count; }