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

namespace Insight.Infrastructure.Entities
{
    [BsonIgnoreExtraElements]
    public class HostInterfaceEntity
    {
        [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("index")]
        public uint? Index { get; set; }

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

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

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

        [BsonElement("physical")]
        public bool? Physical { get; set; }

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

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

        [BsonElement("speed")]
        public long? Speed { get; set; }

        [BsonElement("ipv4_mtu")]
        public long? Ipv4Mtu { get; set; }

        [BsonElement("ipv4_dhcp")]
        public bool? Ipv4Dhcp { get; set; }

        [BsonElement("ipv4_forwarding")]
        public bool? Ipv4Forwarding { get; set; }

        [BsonElement("ipv6_mtu")]
        public long? Ipv6Mtu { get; set; }

        [BsonElement("sent")]
        public long? Sent { get; set; }

        [BsonElement("received")]
        public long? Received { get; set; }

        [BsonElement("packets_incoming_discarded")]
        public long? IncomingPacketsDiscarded { get; set; }

        [BsonElement("packets_incoming_errors")]
        public long? IncomingPacketsWithErrors { get; set; }

        [BsonElement("packets_incoming_unknown")]
        public long? IncomingUnknownProtocolPackets { get; set; }

        [BsonElement("packets_outgoing_discarded")]
        public long? OutgoingPacketsDiscarded { get; set; }

        [BsonElement("packets_outgoing_errors")]
        public long? OutgoingPacketsWithErrors { get; set; }
    }

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

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

        [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
        public string? Interface { 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("address")]
        public string? Address { get; set; }

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

        //public string? State { get; set; }
        //public long? PreferredLifetime { get; set; }
        //public long? ValidLifetime { get; set; }
        //public long? LeaseLifetime { get; set; }
        //public int? PrefixLength { get; set; }

        [BsonIgnoreIfNull, JsonIgnore]
        public List<HostInterfaceEntity>? Interfaces { get; set; }
    }

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

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

        [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
        public string? Interface { 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("address")]
        public string? Address { get; set; }

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

        [BsonIgnoreIfNull, JsonIgnore]
        public List<HostInterfaceEntity>? Interfaces { get; set; }
    }

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

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

        [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
        public string? Interface { 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("address")]
        public string? Address { get; set; }

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

        [BsonIgnoreIfNull, JsonIgnore]
        public List<HostInterfaceEntity>? Interfaces { get; set; }
    }

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

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

        [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
        public string? Interface { 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("destination")]
        public string? Destination { get; set; }

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

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

        [BsonElement("metric")]
        public int? Metric { get; set; }

        [BsonIgnoreIfNull, JsonIgnore]
        public List<HostInterfaceEntity>? Interfaces { get; set; }
    }
}