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<HostSysGroupEntity> HostSystemGroup(this IMongoDatabase database) => database.GetCollection<HostSysGroupEntity>("host_sysgrp");
}

[BsonIgnoreExtraElements]
public class HostSysGroupEntity
{
    [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("sid")]
    public string? Sid { get; set; }

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

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

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

    [BsonElement("localaccount")]
    public bool? LocalAccount { get; set; }
}