using BO.AppServer.Metadata.Dto;
using BO.Console.Commands.Base;
using Quadarax.Foundation.Core.QConsole;
using Quadarax.Foundation.Core.QConsole.Attributes;

namespace BO.Console.Commands.Catalogues
{
    [CommandDefinition]
    internal class BillingPlanAddCommand : AbstractPostCommand<BillingPlanCDto, BillingPlanRDto>
    {
        #region *** Constants ***
        private const string CS_CMD_BPLANADD_NAME = "bplan_add";
        private const string CS_CMD_BPLANADD_DESCR = "Add new billing plan/s by import file.";
        #endregion

        #region *** Properties ***

        public override string Name => CS_CMD_BPLANADD_NAME;
        public override string Description => CS_CMD_BPLANADD_DESCR;

        #endregion

        #region *** Constructor ***
        public BillingPlanAddCommand(Engine engine) : base(engine)
        {
        }
        #endregion

        #region *** EXECUTE ***
        protected override BillingPlanRDto IterationExecute(BillingPlanCDto data)
        {
            WriteDebugInfo($"MimeType '{data.Code}' starts creating...");
            var result = Client.CreateBillingPlanAsync(data).Result;
            WriteCaption($"BillingPlan '{data.Code}' created.");
            return result;
        }

        #endregion

        #region *** Private operations ***
        #endregion

    }
}