using BO.Console.Commands.Base;
using Quadarax.Foundation.Core.QConsole;
using Quadarax.Foundation.Core.QConsole.Attributes;
using Quadarax.Foundation.Core.Value;

namespace BO.Console.Commands.User
{
    [CommandDefinition]
    internal class UsersGetCommand : AbstractListScopedCommand<AppServer.Metadata.Enums.UserScopeEnums>
    {
        #region *** Constants ***

        private const string CS_CMD_USERGET_NAME = "user_list";
        private const string CS_CMD_USERGET_DESCR = "Get list of users by specification scope.";

        #endregion

        #region *** Properties ***

        public override string Name => CS_CMD_USERGET_NAME;
        public override string Description => CS_CMD_USERGET_DESCR;

        #endregion

        #region *** Constructor ***

        public UsersGetCommand(Engine engine) : base(engine)
        {
        }

        #endregion

        #region *** EXECUTE ***

        protected override Result OnExecute()
        {
            var users = Client.GetUsersAsync(Scope, Paging).Result;
            WriteDtoToConsole(users,"Id","Name","Created","LastLogged", "IsSystem", "IsEnabled");
            return new Result();
        }

        #endregion

        #region *** Private operations ***

        #endregion
    }
}
