using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;

namespace Insight.Infrastructure.Entities
{
    [BsonIgnoreExtraElements]
    public class HostStoragePoolEntity
    {
        [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
        public string? Id { get; set; }

        [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
        public string? Host { get; set; }

        [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
        public string? Batch { get; set; }

        [BsonElement("insert")]
        public DateTime? Insert { get; set; }

        [BsonElement("update")]
        public DateTime? Update { get; set; }

        [BsonElement("uniqueid")]
        public string? UniqueId { get; set; }

        [BsonElement("name")]
        public string? Name { get; set; }

        [BsonElement("health")]
        public string? Health { get; set; }

        [BsonElement("resiliency")]
        public string? Resiliency { get; set; }

        [BsonElement("primordial")]
        public bool? Primordial { get; set; }

        [BsonElement("readonly")]
        public bool? ReadOnly { get; set; }

        [BsonElement("clustered")]
        public bool? Clustered { get; set; }

        [BsonElement("size")]
        public ulong? Size { get; set; }

        [BsonElement("size_allocated")]
        public ulong? AllocatedSize { get; set; }

        [BsonElement("sectorsize")]
        public ulong? SectorSize { get; set; }

        [BsonElement("states")]
        public List<string>? States { get; set; }

        [BsonIgnoreIfNull, JsonIgnore]
        public List<HostStoragePoolPhysicalDiskEntity>? PhysicalDisks { get; set; }

        [BsonIgnoreIfNull, JsonIgnore]
        public List<HostStoragePoolVirtualDiskEntity>? VirtualDisks { get; set; }
    }

    [BsonIgnoreExtraElements]
    public class HostStoragePoolVirtualDiskEntity
    {
        [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
        public string? Id { get; set; }

        [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
        public string? Host { get; set; }

        [BsonElement("_storagepool"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("storagepool")]
        public string? StoragePool { get; set; }

        [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
        public string? Batch { get; set; }

        [BsonElement("insert")]
        public DateTime? Insert { get; set; }

        [BsonElement("update")]
        public DateTime? Update { get; set; }

        [BsonElement("uniqueid")]
        public string? UniqueId { get; set; }

        [BsonElement("name")]
        public string? Name { get; set; }

        [BsonElement("health")]
        public string? Health { get; set; }

        [BsonElement("access")]
        public string? Access { get; set; }

        [BsonElement("provisioning")]
        public string? Provisioning { get; set; }

        [BsonElement("redundancy")]
        public uint? PhysicalRedundancy { get; set; }

        [BsonElement("resiliency")]
        public string? Resiliency { get; set; }

        [BsonElement("deduplication")]
        public bool? Deduplication { get; set; }

        [BsonElement("snapshot")]
        public bool? Snapshot { get; set; }

        [BsonElement("size")]
        public ulong? Size { get; set; }

        [BsonElement("size_allocated")]
        public ulong? AllocatedSize { get; set; }

        [BsonElement("footprint")]
        public ulong? Footprint { get; set; }

        [BsonElement("cache_read_size")]
        public ulong? ReadCacheSize { get; set; }

        [BsonElement("cache_write_size")]
        public ulong? WriteCacheSize { get; set; }

        [BsonElement("states")]
        public List<string>? States { get; set; }
    }

    [BsonIgnoreExtraElements]
    public class HostStoragePoolPhysicalDiskEntity
    {
        [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
        public string? Id { get; set; }

        [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
        public string? Host { get; set; }

        [BsonElement("_storagepool"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("storagepool")]
        public string? StoragePool { get; set; }

        [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
        public string? Batch { get; set; }

        [BsonElement("insert")]
        public DateTime? Insert { get; set; }

        [BsonElement("update")]
        public DateTime? Update { get; set; }

        [BsonElement("uniqueid")]
        public string? UniqueId { get; set; }

        [BsonElement("deviceid")]
        public string? DeviceId { get; set; }

        [BsonElement("name")]
        public string? Name { get; set; }

        [BsonElement("manufacturer")]
        public string? Manufacturer { get; set; }

        [BsonElement("Model")]
        public string? Model { get; set; }

        [BsonElement("media")]
        public string? Media { get; set; }

        [BsonElement("bus")]
        public string? Bus { get; set; }

        [BsonElement("health")]
        public string? Health { get; set; }

        [BsonElement("usage")]
        public ushort? Usage { get; set; }

        [BsonElement("location")]
        public string? Location { get; set; }

        [BsonElement("serial")]
        public string? Serial { get; set; }

        [BsonElement("firmware")]
        public string? Firmware { get; set; }

        [BsonElement("size")]
        public ulong? Size { get; set; }

        [BsonElement("size_allocated")]
        public ulong? AllocatedSize { get; set; }

        [BsonElement("footprint")]
        public ulong? Footprint { get; set; }

        [BsonElement("sector_size_physical")]
        public ulong? PhysicalSectorSize { get; set; }

        [BsonElement("sector_size_logical")]
        public ulong? LogicalSectorSize { get; set; }

        [BsonElement("states")]
        public List<string>? States { get; set; }
    }
}