local D = {}

function D.getId ()
	return "merchant0"
end

function D.isAvailable ()
	return Town.getCurrentTownIndex() + 1 == Towns.Marciudad
end

function D.getName ()
	return DialogManager.translate("title", D.getId())
end

function D.getTopics ()

	local topics = {}

	table.insert(topics, "greet")

	if DialogManager.isDialogTreeOpened("greet", D.getId()) then
		table.insert(topics, "ask_about_goods")
		if QuestManager.questCompleted({id = "gettingstarted"}) then
			table.insert(topics, "get_spice_quest")
		end
	end

	return topics

end

function D.getTopicTitle (topicKey)
	return nil
end

-- Register globally
DialogManager.Dialogs[D.getId()] = D
