using e_suite.Messaging.Common.models;
using eSuite.Core.Miscellaneous;
using Microsoft.Extensions.Configuration;

namespace e_suite.Messaging.Common;

public class ActivityMessageSender : MessageSenderBase, IActivityMessageSender
{
    public ActivityMessageSender(IConfiguration configuration, IRabbitMqConnectionFactory connectionFactory) : base(configuration, connectionFactory, MessageQueueNames.Activity)
    {
    }

    public void ProgressActivity(GeneralIdRef generalIdRef)
    {
        var progressActivityMessage = new ProgressActivityMessage
        {
            MessageType = ActivityMessageTypes.ProgressActivity,
            ActivityId = generalIdRef
        };

        Task.Run(async () =>
        {
            await PostMessage(progressActivityMessage);
        }).Wait();
    }
}