/// <summary>
        /// Builds a condition element from parsed data
        /// </summary>
        /// <param name="parsedData">Parsed data</param>
        /// <param name="project">Project</param>
        /// <param name="errorCollection">Error Collection</param>
        /// <param name="flexFieldObject">Flex field object to which the dialog belongs</param>
        /// <param name="exportSettings">Export Settings</param>
        /// <returns>Condition string</returns>
        public override string BuildConditionElementFromParsedData(QuestStateConditionResolver.QuestStateConditionData parsedData, GoNorthProject project, ExportPlaceholderErrorCollection errorCollection, FlexFieldObject flexFieldObject, ExportSettings exportSettings)
        {
            ExportTemplate       conditionTemplate = _defaultTemplateProvider.GetDefaultTemplateByType(project.Id, TemplateType.TaleConditionQuestState).Result;
            IFlexFieldExportable quest             = _cachedDbAccess.GetQuestById(parsedData.QuestId).Result;

            if (quest == null)
            {
                errorCollection.AddDialogQuestNotFoundError();
                return(string.Empty);
            }

            string conditionCode = ExportUtil.RenderPlaceholderIfTrue(conditionTemplate.Code, Placeholder_QuestState_NotStarted_Start, Placeholder_QuestState_NotStarted_End, parsedData.State == QuestState_NotStarted);

            conditionCode = ExportUtil.RenderPlaceholderIfTrue(conditionCode, Placeholder_QuestState_InProgress_Start, Placeholder_QuestState_InProgress_End, parsedData.State == QuestState_InProgress);
            conditionCode = ExportUtil.RenderPlaceholderIfTrue(conditionCode, Placeholder_QuestState_Success_Start, Placeholder_QuestState_Success_End, parsedData.State == QuestState_Success);
            conditionCode = ExportUtil.RenderPlaceholderIfTrue(conditionCode, Placeholder_QuestState_Failed_Start, Placeholder_QuestState_Failed_End, parsedData.State == QuestState_Failed);

            ExportObjectData flexFieldExportData = new ExportObjectData();

            flexFieldExportData.ExportData.Add(ExportConstants.ExportDataObject, quest);
            flexFieldExportData.ExportData.Add(ExportConstants.ExportDataObjectType, ExportConstants.ExportObjectTypeQuest);

            _flexFieldPlaceholderResolver.SetErrorMessageCollection(errorCollection);
            conditionCode = _flexFieldPlaceholderResolver.FillPlaceholders(conditionCode, flexFieldExportData).Result;

            return(conditionCode);
        }
        /// <summary>
        /// Returns the quest use
        /// </summary>
        /// <param name="parsedData">Parsed data</param>
        /// <param name="errorCollection">Error Collection</param>
        /// <returns>Value Object</returns>
        private async Task <IFlexFieldExportable> GetQuest(AddQuestTextRenderer.AddQuestTextData parsedData, ExportPlaceholderErrorCollection errorCollection)
        {
            AikaQuest quest = await _cachedDbAccess.GetQuestById(parsedData.QuestId);

            if (quest == null)
            {
                errorCollection.AddDialogQuestNotFoundError();
                return(null);
            }

            return(quest);
        }
        /// <summary>
        /// Loads the reference node data
        /// </summary>
        /// <param name="referenceNode">Reference node</param>
        /// <returns>Reference node data</returns>
        private async Task <ReferenceNodeData> GetReferenceNodeData(ReferenceNode referenceNode)
        {
            ReferenceNodeData referenceNodeData = new ReferenceNodeData();

            referenceNodeData.ReferenceText = referenceNode.ReferenceText;
            referenceNodeData.ObjectType    = referenceNode.ReferencedObjects.Any() ? referenceNode.ReferencedObjects[0].ObjectType : ExportConstants.ExportObjectTypeNone;
            switch (referenceNodeData.ObjectType.ToLowerInvariant())
            {
            case ExportConstants.ExportObjectTypeNpc:
                referenceNodeData.Npc = await _exportCachedDbAccess.GetNpcById(referenceNode.ReferencedObjects[0].ObjectId);

                break;

            case ExportConstants.ExportObjectTypeItem:
                referenceNodeData.Item = await _exportCachedDbAccess.GetItemById(referenceNode.ReferencedObjects[0].ObjectId);

                break;

            case ExportConstants.ExportObjectTypeSkill:
                referenceNodeData.Skill = await _exportCachedDbAccess.GetSkillById(referenceNode.ReferencedObjects[0].ObjectId);

                break;

            case ExportConstants.ExportObjectTypeQuest:
                referenceNodeData.Quest = await _exportCachedDbAccess.GetQuestById(referenceNode.ReferencedObjects[0].ObjectId);

                break;

            case ExportConstants.ExportObjectTypeWikiPage:
                referenceNodeData.WikiPage = await _exportCachedDbAccess.GetWikiPageById(referenceNode.ReferencedObjects[0].ObjectId);

                break;

            case ExportConstants.ExportObjectTypeMapMarker:
                referenceNodeData.Marker = await _exportCachedDbAccess.GetMarkerById(referenceNode.ReferencedObjects[1].ObjectId, referenceNode.ReferencedObjects[0].ObjectId);

                break;

            case ExportConstants.ExportObjectTypeDailyRoutineEvent:
                referenceNodeData.Npc = await _exportCachedDbAccess.GetNpcById(referenceNode.ReferencedObjects[1].ObjectId);

                referenceNodeData.DailyRoutineEvent = referenceNodeData.Npc.DailyRoutine != null?referenceNodeData.Npc.DailyRoutine.FirstOrDefault(d => d.EventId == referenceNode.ReferencedObjects[0].ObjectId) : null;

                break;
            }

            return(referenceNodeData);
        }
        /// <summary>
        /// Returns the value object to use for scriban exporting
        /// </summary>
        /// <param name="parsedData">Parsed data</param>
        /// <param name="project">Project</param>
        /// <param name="errorCollection">Error Collection</param>
        /// <param name="flexFieldObject">Flex field object to which the dialog belongs</param>
        /// <param name="exportSettings">Export Settings</param>
        /// <returns>Value Object</returns>
        protected override async Task <ScribanQuestStateConditionData> GetExportObject(QuestStateConditionData parsedData, GoNorthProject project, ExportPlaceholderErrorCollection errorCollection, FlexFieldObject flexFieldObject, ExportSettings exportSettings)
        {
            AikaQuest quest = await _cachedDbAccess.GetQuestById(parsedData.QuestId);

            if (quest == null)
            {
                errorCollection.AddDialogQuestNotFoundError();
                return(null);
            }

            ScribanQuestStateConditionData conditionData = new ScribanQuestStateConditionData();

            conditionData.Quest      = FlexFieldValueCollectorUtil.BuildFlexFieldValueObject <ScribanExportQuest>(null, null, quest, exportSettings, errorCollection);
            conditionData.QuestState = ConvertQuestState(parsedData.State);

            return(conditionData);
        }