local D = {}

function D.show (index)

	DialogManager.CurrentDialogIndex = index

	if index == 1 then
		DialogManager.showDialog({key = "ask_about_store_text_1", options = {{key = "continue", id = ConstEndDialog}}})
	end

end

-- Called when choosing an reply option from the list
function D.dismiss (index, identifier)

	-- Reply that indicates to end the dialog tree
	if identifier == ConstEndDialog then

		-- Make 'merchant2' dialog available
		if DialogManager.isDialogAvailable("merchant2") == false then
			DialogManager.setDialogAvailable("merchant2", true)
			gVarStore.setBool("converse_dialog_screen", true)
			gGUI.showInfoMessage({text = DialogManager.translate("change_converstation_tip"), middle = true})
		end

		DialogManager.endCurrentDialogTree()

		return
	end

	D.show(DialogManager.CurrentDialogIndex + 1)
end

-- Called when dialog tree is initialized
function D.started ()
	D.show(1)
end

-- Called when dialog tree is terminated
function D.ended()

end

-- Register globally
DialogManager.Dialogs["tavernkeeper2"].DialogTrees["ask_about_store"] = D
