namespace Bts.DataStream.Services;
using BCG;
using bts.api.core;
using Bts.PubSub;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Linq;
// public static class DataStreamPublisherServices {
// ///
// /// Adds a singleton service only if a service of type hasn't been added
// /// already.
// ///
// ///
// ///
// ///
// public static IServiceCollection EnsureSingleton(this IServiceCollection services) where T : class =>
// services.HasService()
// ? services
// : services.AddSingleton();
// ///
// /// Adds a singleton service only if a service of type hasn't been added
// /// already.
// ///
// ///
// ///
// ///
// public static IServiceCollection EnsureSingleton(this IServiceCollection services, Func implementationFactory) where T : class =>
// services.HasService()
// ? services
// : services.AddSingleton(implementationFactory);
// ///
// /// Adds a singleton service only if a service of type hasn't been added
// /// already.
// ///
// /// The type of the service to add.
// /// The type of the implementation to use.
// /// The to add the service to.
// /// A reference to this instance after the operation has completed.
// public static IServiceCollection EnsureSingleton(this IServiceCollection services) where T : class where TImplementation : class, T =>
// services.HasService()
// ? services
// : services.AddSingleton();
// ///
// /// Adds a singleton service only if a service of type hasn't been added
// /// already.
// ///
// /// The type of the service to add.
// /// The to add the service to.
// /// A reference to this instance after the operation has completed.
// public static IServiceCollection EnsureKeyedSingleton(this IServiceCollection services, object? key) where T : class =>
// services.HasKeyedService(key)
// ? services
// : services.AddKeyedSingleton(key);
// ///
// /// Adds a singleton service only if a service of type hasn't been added
// /// already.
// ///
// /// The type of the service to add.
// /// The to add the service to.
// /// A reference to this instance after the operation has completed.
// public static IServiceCollection EnsureHostedService(this IServiceCollection services) where T : class, IHostedService =>
// services.HasService()
// ? services
// : services.AddHostedService();
// ///
// /// Adds a singleton service only if a service of type hasn't been added
// /// already.
// ///
// /// The type of the service to add.
// /// The to add the service to.
// /// A reference to this instance after the operation has completed.
// public static IServiceCollection EnsureHostedService(this IServiceCollection services, Func implementationFactory) where T : class, IHostedService =>
// services.HasService()
// ? services
// : services.AddHostedService(implementationFactory);
// public static bool HasService(this IServiceCollection services) =>
// services.Any(s => s.ServiceType.IsAssignableTo(typeof(T)));
// public static bool HasKeyedService(this IServiceCollection services, object? key) =>
// services.Any(s => Equals(s.ServiceKey, key) && s.ServiceType.IsAssignableTo(typeof(T)));
// }