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

namespace Insight.Infrastructure.Entities;

public static partial class MongoDatabaseExtensions
{
    public static IMongoCollection<HostGroupHostEntity> HostGroupHost(this IMongoDatabase database) => database.GetCollection<HostGroupHostEntity>("hostgroup_host");
}

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

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

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

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

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