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<HostSysUserSysGroupEntity> HostSystemUserSystemGroup(this IMongoDatabase database) => database.GetCollection<HostSysUserSysGroupEntity>("host_sysusr_sysgrp");
}

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

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

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

    [BsonElement("_group"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("group")]
    public string? Group { 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; }
}