using MemoryPack;

namespace Insight.Agent.Messages
{
    [MemoryPackUnion(40, typeof(Memory))]
    [MemoryPackUnion(41, typeof(MemoryList))]
    public partial interface IAgentMessage { }

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

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

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

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

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

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

        [MemoryPackOrder(6)]
        public ulong? Capacity { get; set; }

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

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

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

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

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

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

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

        [MemoryPackOrder(2)]
        public float? MemoryAvailablePercentage { get; set; }

        [MemoryPackOrder(3)]
        public float? MemoryUsed { get; set; }

        [MemoryPackOrder(4)]
        public float? MemoryUsagePercentage { get; set; }
    }
}