using Hcs.Broker;
using Hcs.Broker.MessageCapturer;
using Hcs.WebApp.Config;

namespace Hcs.WebApp.Services
{
    public class ClientProvider : IClientProvider
    {
        public IClient CreateClient(BrokerConfig config, Broker.Logger.ILogger logger, IMessageCapturer messageCapturer)
        {
            var client = new Client
            {
                OrgPPAGUID = config.OrgPPAGUID,
                ExecutorGUID = config.ExecutorGUID,
                UseTunnel = false,
                IsPPAK = false,
                Role = OrganizationRole.RSO,
                Logger = logger,
                MessageCapturer = messageCapturer
            };

            client.SetSigningCertificate(config.CertificateSerialNumber);

            return client;
        }
    }
}
