/// <summary>
        /// Turns a command string into a <see cref="ShowTransactionsOption"/>.
        /// </summary>
        /// <param name="payCommand">A command from command line, to show the transactions.</param>
        /// <returns>The class with show transaction properties.</returns>
        public static ShowTransactionsOption DecodeShowTransactions(this string showTransactionsCommand)
        {
            string[] args = showTransactionsCommand.Split(' ');
            ShowTransactionsOption showTransactions = new ShowTransactionsOption();

            CommandLine.Parser.Default.ParseArguments(args, showTransactions);

            return(showTransactions);
        }
        /// <summary>
        /// Shows the transactions performed so far in the current execution
        /// of the program.
        /// </summary>
        /// <param name="showOptions">Information to filter the data to be logged.</param>
        public void ShowTransactions(ShowTransactionsOption showOptions)
        {
            if (showOptions.ShowAll == true)
            {
                Console.WriteLine("TODAS AS TRANSACOES:");
                this.Transactions.ShowTransactionsOnScreen();
            }

            if (showOptions.ShowOnlyApproved == true)
            {
                Console.WriteLine("APENAS TRANSACOES APROVADAS:");
                this.Transactions.ShowTransactionsOnScreen((t, e) => t.IsCaptured == true);
            }

            if (showOptions.ShowOnlyCancelledOrNotApproved == true)
            {
                Console.WriteLine("APENAS TRANSACOES NAO APROVADAS:");
                this.Transactions.ShowTransactionsOnScreen((t, e) => t.IsCaptured == false);
            }
        }
        /// <summary>
        /// Decodes the command name and performs the corresponding action.
        /// The commands supported are:
        ///     - "ativar": activate and connect to one terminal;
        ///     - "pagar": pay something;
        ///     - "resumo": transaction sumamry, it can be filtered by approved
        ///     transactions, not approved or cancelled transactions or all transactions;
        ///     - "cancel": cancel a transaction by it's Stone ID;
        ///     - "sair": disconnect from the terminal and exit the application.
        /// </summary>
        /// <param name="command">Command typed by the user.</param>
        /// <returns>Whether it has to exit the application or not.</returns>
        public static bool Decode(this string command)
        {
            string[] args        = command.Split(' ');
            string   commandName = args[0];
            string   baseCommand = string.Join(" ", args, 1, args.Length - 1);

            switch (commandName)
            {
            case "ativar":
                ActivateOption activation = baseCommand.DecodeActivation();
                AuthorizationCore.GetInstance()
                .TryActivate(activation);
                break;

            case "pagar":
                TransactionOption transaction = baseCommand.DecodeTransaction();
                AuthorizationCore.GetInstance()
                .Authorize(transaction);
                break;

            case "resumo":
                ShowTransactionsOption showOptions = baseCommand.DecodeShowTransactions();
                AuthorizationCore.GetInstance()
                .ShowTransactions(showOptions);
                break;

            case "cancelar":
                CancelationOption cancelation = baseCommand.DecodeCancelation();
                AuthorizationCore.GetInstance()
                .Cancel(cancelation);
                break;

            case "sair":
                AuthorizationCore.GetInstance()
                .ClosePinpad();
                return(true);
            }

            return(false);
        }