using MemoryPack;

namespace Insight.Agent.Messages
{
    [MemoryPackUnion(130, typeof(Service))]
    [MemoryPackUnion(131, typeof(ServiceList))]
    public partial interface IAgentMessage { }

    [MemoryPackable]
    public partial class Service : IAgentMessage
    {
        [MemoryPackOrder(0)]
        public uint? ProcessId { get; set; }

        [MemoryPackOrder(1)]
        public string? Name { get; set; }

        [MemoryPackOrder(2)]
        public string? Display { get; set; }

        [MemoryPackOrder(3)]
        public string? Description { get; set; }

        [MemoryPackOrder(4)]
        public string? PathName { get; set; }

        [MemoryPackOrder(5)]
        public string? Account { get; set; }

        [MemoryPackOrder(6)]
        public bool? Delay { get; set; }

        [MemoryPackOrder(7)]
        public ServiceStatus? Status { get; set; }

        [MemoryPackOrder(8)]
        public ServiceMode? StartMode { get; set; }

        public enum ServiceStatus
        {
            Unknown = -1,
            Stopped = 1,
            StartPending = 2,
            StopPending = 3,
            Running = 4,
            ContinuePending = 5,
            PausePending = 6,
            Paused = 7
        }

        public enum ServiceMode
        {
            Unknown = -1,
            Boot = 0,
            System = 1,
            Automatic = 2,
            Manual = 3,
            Disabled = 4
        }
    }

    [MemoryPackable(GenerateType.Collection)]
    public partial class ServiceList : List<Service>, IAgentMessage { }
}