using System.Linq;
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.Catalogues
{
    [CommandDefinition]
    internal class MimeTypesGetCommand : AbstractListScopedCommand<AppServer.Metadata.Enums.MimeTypeScopeEnums>
    {
        #region *** Constants ***

        private const string CS_CMD_MIMEGET_NAME = "mime_list";
        private const string CS_CMD_MIMEGET_DESCR = "Get list of mime types by specification scope.";

        #endregion

        #region *** Properties ***

        public override string Name => CS_CMD_MIMEGET_NAME;
        public override string Description => CS_CMD_MIMEGET_DESCR;

        #endregion

        #region *** Constructor ***

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

        #endregion

        #region *** EXECUTE ***

        protected override Result OnExecute()
        {
            var mimes = Client.GetMimeTypesAsync(Scope, Paging).Result;
            WriteDtoToConsole(mimes,"Id","Mimetype1","Description","Extensions","IsEnabled");
            return new Result();
        }

        #endregion

        #region *** Private operations ***

        #endregion
    }
}
