using System.Text.Json.Serialization; namespace LibSystemdCli.Models; public class SystemdUnitListItem { [JsonPropertyName("unit")] public string Unit { get; set; } = null!; [JsonPropertyName("description")] public string Description { get; set; } = null!; [JsonPropertyName("load")] public string Load { get; set; } = null!; [JsonPropertyName("active")] public string Active { get; set; } = null!; [JsonPropertyName("sub")] public string Sub { get; set; } = null!; [JsonPropertyName("job")] public string Job { get; set; } = null!; [JsonPropertyName("x-fragment-paths")] public List FragmentPaths { get; set; } = null!; [JsonIgnore] public string UnitType => Unit.Split('.').Last(); [JsonIgnore] public bool IsSystem => IsGenerated || IsFromPackage; [JsonIgnore] public bool IsGenerated => FragmentPaths.Any(x => x.StartsWith("/run/systemd/generator/")) || FragmentPaths.Any(x=>x.StartsWith("/run/systemd/transient/")) || FragmentPaths.Count == 0; [JsonIgnore] public bool IsFromPackage => FragmentPaths.Any(x => x.StartsWith("/usr/lib/systemd/")); }