using System.Security.Principal;
using Quadarax.Foundation.Core.Business.Interface;
using Quadarax.Foundation.Core.Data;
using Quadarax.Foundation.Core.Data.Interface.Entity;
using Quadarax.Foundation.Core.Data.Interface.Entity.Dto;
using Quadarax.Foundation.Core.Logging;

namespace Quadarax.Foundation.Core.Business
{

     public abstract class AbstractService : IService
    {
        #region *** Properties ***
        protected ILog Log { get; }
        protected IPrincipal CurrentPrincipal { get; }
        #endregion

        #region *** Constructors ***
        protected AbstractService(IPrincipal currentPrincipal, ILogger logger)
        {
            Log = logger.GetLogger(typeof(AbstractService));

            if (currentPrincipal == null)
            {
                var genericIdentity = new GenericIdentity("genericIdentity");
                currentPrincipal = new GenericPrincipal(genericIdentity, new string[] {});
            }
            CurrentPrincipal = currentPrincipal;
            Log.Log(LogSeverityEnum.Trace, $"Service '{GetType().Name}' [Hash:{GetHashCode()}] initialized.");
        }
        #endregion

        #region *** Public Operations ***
        public IResult Test()
        {
            return new ResultPlain();
        }

        #endregion
    }

 
}
