public EducationController(IUser user, IStudySession studySession, ConversationController cc)
 {
     this.user                   = user;
     this.db                     = new DataBaseController();
     this.studySession           = studySession;
     this.ConversationController = cc;
     Qac = new QuestionsAnswersControllers();
 }
        private string[] formatPhrases(string[] val)
        {
            var res = new List <string>();

            foreach (var s in val)
            {
                res.Add(ConversationController.formatPhrases(s));
            }
            return(res.ToArray());
        }
        private string[] answerArrayToString(List <string> answers, string[] verbalFeedback)
        {
            if (answers.Count > 1)
            {
                var last = answers[answers.Count - 1];
                answers.RemoveAt(answers.Count - 1);
                foreach (var a in answers)
                {
                    verbalFeedback = ConversationController.mergeText(verbalFeedback, a.Trim() + ",");
                }

                verbalFeedback = ConversationController.mergeText(verbalFeedback, ConversationController.mergeText(ConversationController.getPhrase(Pkey.and), last));
            }
            else if (answers.Count == 1)
            {
                verbalFeedback = ConversationController.mergeText(verbalFeedback, answers[0]);
            }

            return(verbalFeedback);
        }
        public string[] createReplayToUser(string text, UserIntent answerIntent)
        {
            //if user pressing category
            if (getStudyCategory().Contains(text.Trim()))
            {
                throw new menuException();
            }


            switch (answerIntent)
            {
            case UserIntent.dontKnow:
                var feedback = ConversationController.getPhrase(Pkey.neverMind);
                feedback = ConversationController.mergeText(feedback, ConversationController.getPhrase(Pkey.MyAnswerToQuestion));
                feedback = answerArrayToString(new List <string>(studySession.CurrentSubQuestion.answerText.Split('|')), feedback);
                return(feedback);

            case UserIntent.menu:
                throw new menuException();

            case UserIntent.stopSession:
                throw new StopSessionException();

            case UserIntent.sessionBreak:
                throw new sessionBreakException();

            case UserIntent.bot_questions:
            case UserIntent.DefaultFallbackIntent:
            case UserIntent.unknown:
            case UserIntent.historyAnswer:
            default:
                return(formatPhrases(qac.createFeedBack(checkAnswer(text))));
            }

            return(null);
        }