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

namespace Insight.Infrastructure.Entities
{
    [BsonIgnoreExtraElements]
    public class HostHypervisorVirtualMaschineEntity
    {
        [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("notes")]
        public string? Notes { get; set; }

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

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

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

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

        [BsonElement("ontime")]
        public ulong? OnTime { get; set; }

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

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

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

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

        [BsonElement("processid")]
        public uint? ProcessId { get; set; }

        [BsonElement("processor_count")]
        public uint? NumberOfProcessors { get; set; }

        [BsonElement("processor_load")]
        public uint? ProcessorLoad { get; set; }

        [BsonElement("memory_available")]
        public int? MemoryAvailable { get; set; }

        [BsonElement("memory_usage")]
        public ulong? MemoryUsage { get; set; }

        [BsonElement("installdate")]
        public DateTime? InstallDate { get; set; }

        [BsonElement("configuration_changed")]
        public DateTime? TimeOfLastConfigurationChange { get; set; }

        [BsonElement("state_changed")]
        public DateTime? TimeOfLastStateChange { get; set; }

        [BsonElement("replication_last")]
        public DateTime? LastReplicationTime { get; set; }

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

        [BsonIgnoreIfNull, JsonIgnore]
        public List<HostHypervisorVirtualMaschineConfigEntity>? Configs { get; set; }
    }

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

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

        [BsonElement("virtualmaschine"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("virtualmaschine")]
        public string? VirtualMaschine { 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("parentid")]
        public string? ParentId { get; set; }

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

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

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

        [BsonElement("creationtime")]
        public DateTime? CreationTime { get; set; }

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

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

        [BsonElement("secureboot")]
        public bool? SecureBootEnabled { get; set; }

        [BsonElement("automatic_snapshot")]
        public bool? IsAutomaticSnapshot { get; set; }

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

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

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

        [BsonElement("auto_snapshots")]
        public bool? AutomaticSnapshotsEnabled { get; set; }

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

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

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

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

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

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

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

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

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

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