using MemoryPack;

namespace Insight.Agent.Messages
{
    [MemoryPackUnion(160, typeof(StoragePool))]
    [MemoryPackUnion(161, typeof(StoragePoolList))]
    public partial interface IAgentMessage { }

    [MemoryPackable]
    public partial class StoragePool : IAgentMessage
    {
        [MemoryPackOrder(0)]
        public string? UniqueId { get; set; }

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

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

        [MemoryPackOrder(3)]
        public List<OperationalState>? States { get; set; }

        [MemoryPackOrder(4)]
        public HealthState? Health { get; set; }

        [MemoryPackOrder(5)]
        public RetireMissingPhysicalDisksEnum? RetireMissingPhysicalDisks { get; set; }

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

        [MemoryPackOrder(7)]
        public bool? IsPrimordial { get; set; }

        [MemoryPackOrder(8)]
        public bool? IsReadOnly { get; set; }

        [MemoryPackOrder(9)]
        public bool? IsClustered { get; set; }

        [MemoryPackOrder(10)]
        public ulong? Size { get; set; }

        [MemoryPackOrder(11)]
        public ulong? AllocatedSize { get; set; }

        [MemoryPackOrder(12)]
        public ulong? SectorSize { get; set; }

        [MemoryPackOrder(13)]
        public List<PhysicalDisk>? PhysicalDisks { get; set; }

        [MemoryPackOrder(14)]
        public List<VirtualDisk>? VirtualDisks { get; set; }

        public enum OperationalState
        {
            Unknown = 0,
            Other = 1,
            OK = 2,
            Degraded = 3,
            Stressed = 4,
            Predictive_Failure = 5,
            Error = 6,
            Non_Recoverable_Error = 7,
            Starting = 8,
            Stopping = 9,
            Stopped = 10,
            In_Service = 11,
            No_Contact = 12,
            Lost_Communication = 13,
            Aborted = 14,
            Dormant = 15,
            Supporting_Entity_In_Error = 16,
            Completed = 17,
            Power_Mode = 18,
            Relocating = 19
        }

        public enum HealthState
        {
            Healthy = 0,
            Warning = 1,
            Unhealthy = 2,
            Unknown = 3
        }

        public enum RetireMissingPhysicalDisksEnum
        {
            Auto = 1,
            Always = 2,
            Never = 3
        }
    }

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

    [MemoryPackable]
    public partial class PhysicalDisk : IAgentMessage
    {
        [MemoryPackOrder(0)]
        public string? UniqueId { get; set; }

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

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

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

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

        [MemoryPackOrder(5)]
        public ushort? MediaType { get; set; }

        [MemoryPackOrder(6)]
        public ushort? BusType { get; set; }

        [MemoryPackOrder(7)]
        public List<OperationalState>? States { get; set; }

        [MemoryPackOrder(8)]
        public HealthState? Health { get; set; }

        [MemoryPackOrder(9)]
        public List<SupportedUsagesEnum>? SupportedUsages { get; set; }

        [MemoryPackOrder(10)]
        public ushort? Usage { get; set; }

        [MemoryPackOrder(11)]
        public string? PhysicalLocation { get; set; }

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

        [MemoryPackOrder(13)]
        public string? FirmwareVersion { get; set; }

        [MemoryPackOrder(14)]
        public ulong? Size { get; set; }

        [MemoryPackOrder(15)]
        public ulong? AllocatedSize { get; set; }

        [MemoryPackOrder(16)]
        public ulong? LogicalSectorSize { get; set; }

        [MemoryPackOrder(17)]
        public ulong? PhysicalSectorSize { get; set; }

        [MemoryPackOrder(18)]
        public ulong? VirtualDiskFootprint { get; set; }

        public enum OperationalState
        {
            Unknown = 0,
            Other = 1,
            OK = 2,
            Degraded = 3,
            Stressed = 4,
            Predictive_Failure = 5,
            Error = 6,
            Non_Recoverable_Error = 7,
            Starting = 8,
            Stopping = 9,
            Stopped = 10,
            In_Service = 11,
            No_Contact = 12,
            Lost_Communication = 13,
            Aborted = 14,
            Dormant = 15,
            Supporting_Entity_In_Error = 16,
            Completed = 17,
            Power_Mode = 18,
            Relocating = 19
        }

        public enum HealthState
        {
            Healthy = 0,
            Warning = 1,
            Unhealthy = 2,
            Unknown = 3
        }

        public enum SupportedUsagesEnum
        {
            Unknown = 0,
            Auto_Select = 1,
            Manual_Select = 2,
            Hot_Spare = 3,
            Retired = 4,
            Journal = 5
        }
    }

    [MemoryPackable]
    public partial class VirtualDisk : IAgentMessage
    {
        [MemoryPackOrder(0)]
        public string? UniqueId { get; set; }

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

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

        [MemoryPackOrder(3)]
        public List<OperationalState>? States { get; set; }

        [MemoryPackOrder(4)]
        public HealthState? Health { get; set; }

        [MemoryPackOrder(5)]
        public AccessTypeEnum? AccessType { get; set; }

        [MemoryPackOrder(6)]
        public ProvisioningTypeEnum? ProvisioningType { get; set; }

        [MemoryPackOrder(7)]
        public ushort? PhysicalDiskRedundancy { get; set; }

        [MemoryPackOrder(8)]
        public string? ResiliencySettingName { get; set; }

        [MemoryPackOrder(9)]
        public bool? Deduplication { get; set; }

        [MemoryPackOrder(10)]
        public bool? IsSnapshot { get; set; }

        [MemoryPackOrder(11)]
        public ulong? Size { get; set; }

        [MemoryPackOrder(12)]
        public ulong? AllocatedSize { get; set; }

        [MemoryPackOrder(13)]
        public ulong? FootprintOnPool { get; set; }

        [MemoryPackOrder(14)]
        public ulong? ReadCacheSize { get; set; }

        [MemoryPackOrder(15)]
        public ulong? WriteCacheSize { get; set; }

        public enum OperationalState
        {
            Unknown = 0,
            Other = 1,
            OK = 2,
            Degraded = 3,
            Stressed = 4,
            Predictive_Failure = 5,
            Error = 6,
            Non_Recoverable_Error = 7,
            Starting = 8,
            Stopping = 9,
            Stopped = 10,
            In_Service = 11,
            No_Contact = 12,
            Lost_Communication = 13,
            Aborted = 14,
            Dormant = 15,
            Supporting_Entity_In_Error = 16,
            Completed = 17,
            Power_Mode = 18,
            Relocating = 19
        }

        public enum HealthState
        {
            Healthy = 0,
            Warning = 1,
            Unhealthy = 2,
            Unknown = 3
        }

        public enum AccessTypeEnum
        {
            Unknown = 0,
            Readable = 1,
            Writeable = 2,
            Read_Write = 3,
            Write_Once = 4
        }

        public enum ProvisioningTypeEnum
        {
            Unknown = 0,
            Thin = 1,
            Fixed = 2
        }
    }
}