using MemoryPack;

namespace Insight.Agent.Messages
{
    [MemoryPackUnion(30, typeof(Processor))]
    [MemoryPackUnion(31, typeof(ProcessorList))]
    public partial interface IAgentMessage { }

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

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

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

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

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

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

        [MemoryPackOrder(6)]
        public string? DeviceId { get; set; }

        [MemoryPackOrder(7)]
        public uint? Cores { get; set; }

        [MemoryPackOrder(8)]
        public uint? LogicalCores { get; set; }

        [MemoryPackOrder(9)]
        public uint? CurrentSpeed { get; set; }

        [MemoryPackOrder(10)]
        public uint? MaxSpeed { get; set; }

        [MemoryPackOrder(11)]
        public uint? L1Size { get; set; }

        [MemoryPackOrder(12)]
        public uint? L2Size { get; set; }

        [MemoryPackOrder(13)]
        public uint? L3Size { get; set; }

        [MemoryPackOrder(14)]
        public bool? Virtualization { get; set; }
    }

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

    [MemoryPackable]
    public partial class ProcessorMetric : IAgentMessage
    {
        [MemoryPackOrder(0)]
        public DateTime? Timestamp { get; set; }

        [MemoryPackOrder(1)]
        public float? ProcessorUsagePercentage { get; set; }
    }
}