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

namespace e_suite.Messaging.Common;

public class EFlowSyncMessageSender : MessageSenderBase, IEFlowSyncMessageSender
{
    public EFlowSyncMessageSender(IConfiguration configuration, IRabbitMqConnectionFactory connectionFactory) : base(
        configuration, connectionFactory, MessageQueueNames.EFlowSync)
    {

    }

    public void SyncEFlowPrinterCategories()
    {
        SyncEFlowPrinterCategories([]);
    }

    public void SyncEFlowPrinterCategories(List<GeneralIdRef> domains)
    {
        var message = new EFlowPrinterCategorySyncMessage
        {
            MessageType = EFlowSyncMessageTypes.PrinterCategorySync,
            Domains = domains
        };

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