using Caliburn.Micro.Core;
using MECF.Framework.Common.Account.Permissions;

namespace MECF.Framework.UI.Client.ClientBase
{
    public class BaseModel : Screen
    {
        #region Variables

        protected readonly IEventAggregator EventAggregator;
        private MenuPermissionEnum _permission = MenuPermissionEnum.MP_NONE;

        #endregion

        #region Constructors

        protected BaseModel()
        {
            EventAggregator = IoC.Get<IEventAggregator>();
            EventAggregator?.Subscribe(this);
        }

        #endregion

        #region Properties

        public bool IsPermission => Permission == MenuPermissionEnum.MP_READ_WRITE;
        
        public MenuPermissionEnum Permission
        {
            get => _permission;
            set
            {
                if (_permission == value) 
                    return;
                _permission = value;
                NotifyOfPropertyChange();
            }
        }
        
        #endregion

        
        
    }
}
