using IWS5.Core.Enums;
using IWS5.Core.Helpers;
using IWS5.Server.Helpers.TriggerProcessors;

namespace PDServer.Helpers.TriggerProcessors;

internal static class TriggerProcessorFactory
{
     public static ITriggerProcessor GetTriggerProcessor(ATTriggerAction triggerAction, IMessageProcessor messageProcessor)
    {
        return triggerAction switch
        {
            ATTriggerAction.SendEmail => new EmailTriggerProcessor(messageProcessor),
            ATTriggerAction.SendToEvent => new MoveToEventTriggerProcessor(),
            ATTriggerAction.SendToProcess => new MoveToProcessTriggerProcessor(),
            ATTriggerAction.RunSqlQueryWithResultInFolderField => new AssignFolderFieldValueFromQueryTriggerProcessor(),
            _ => throw new NotImplementedException($"Trigger action '{triggerAction}' is not implemented.")
        };
    }
}