using Hotline.CallCenter.Configs;
using Hotline.CallCenter.Devices;
using Hotline.NewRock.Mappers;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using NewRock.Sdk;

namespace Hotline.NewRock
{
    public static class NewRockStartupExtensions
    {
        public static IServiceCollection AddNewRock(this IServiceCollection services, NewRockConfiguration newrockConfig)
        {
            services
                .AddNewRockSdk(newrockConfig.Address)
                .AddScoped<INewRockDeviceManager, NewRockDeviceManager>()
                ;

            TypeAdapterConfig.GlobalSettings.Scan(typeof(EventConfigs).Assembly);
            
            return services;
        }
    }
}
