using Hotline.Ai.Quality;
using Microsoft.Extensions.DependencyInjection;
using Hotline.Enterprise;
using Hotline.YbEnterprise.Sdk;

namespace Hotline.Api.Sdk
{
    public static class HotlineYbEnterpriseStartupExtensions
    {
        public static IServiceCollection AddYbEnterpriseSdk(this IServiceCollection services, string? baseAddress)
        {
            services.AddScoped<IEnterpriseService, EnterpriseService>();
            if (!string.IsNullOrEmpty(baseAddress))
                services.AddHttpClient(YbEnterpriseDefaults.HttpName, d =>
                {
                    d.BaseAddress = new Uri(baseAddress);
                });
            return services;
        }
    }
}
