using Hotline.FlowEngine.Workflows;
using Hotline.Orders.Notifications;
using MediatR;

namespace Hotline.Application.OrderApp.Handlers.OrderHandler
{
    public class GetOrderDetailNotifyHandler : INotificationHandler<GetOrderDetailNotify>
    {
        private readonly IWorkflowDomainService _workflowDomainService;

        public GetOrderDetailNotifyHandler(IWorkflowDomainService workflowDomainService)
        {
            _workflowDomainService = workflowDomainService;
        }

        /// <summary>Handles a notification</summary>
        /// <param name="notification">The notification</param>
        /// <param name="cancellationToken">Cancellation token</param>
        public async Task Handle(GetOrderDetailNotify notification, CancellationToken cancellationToken)
        {
            await _workflowDomainService.AcceptAsync(notification.Workflow,
                notification.UserId, notification.UserName,
                notification.OrgId, notification.OrgName,
                notification.OrgAreaCode, notification.OrgAreaName,
                cancellationToken);
        }
    }
}
