using System;
using System.Threading.Tasks;
using Quadarax.Foundation.Core.Logging;

namespace Quadarax.Foundation.Core.Thread
{
    public class ContiguousWorker : AbstractWorker
    {
        #region *** Private fields ***
        private readonly Func<Task> _body;
        #endregion

        #region *** Properties ***
        #endregion

        #region *** Constructors ***
        public ContiguousWorker(Func<Task> body = null) : base()
        {
            _body = body;
        }
        public ContiguousWorker(string workerName, ILogger logger = null) : base(workerName,null, logger)
        {
        }
        #endregion

        #region *** Public Operations ***
        #endregion

        #region *** Virtuals and protected ***
        protected override async Task Do(IWorkerContext context)
        {
            await _body.Invoke();
        }
        #endregion

        #region *** Private Operations ***
        #endregion

    }
}
