using Knot.Contracts.Conversations.Domain;
using MongoDB.Bson.Serialization;

namespace Knot.Modules.Conversations.Infrastructure.Persistence.Mongo;

public static class ConversationsMongoDbMapConfigurator
{
    private static bool _initialized;

    public static void Configure()
    {
        if (_initialized) return;

        if (!BsonClassMap.IsClassMapRegistered(typeof(UserFolderSettings)))
        {
            BsonClassMap.RegisterClassMap<UserFolderSettings>(cm =>
            {
                cm.AutoMap();
                cm.SetDiscriminator("UserFolderSettings");
            });
        }

        _initialized = true;
    }
}
