local p = {}

function p.main(frame)
	local entity = mw.wikibase.getEntity()
	if not entity or not entity.claims or not entity.claims.P18 then
		mw.log("no claims")
		return
	end
	for _, statement in ipairs(entity.claims.P18) do
		if (
			statement.rank ~= 'deprecated' and
			statement.mainsnak.snaktype == 'value' and
			statement.qualifiers and statement.qualifiers.P2096
		) then
			for _, qualifier in ipairs(statement.qualifiers.P2096) do
				if (
					qualifier.snaktype == 'value' and
					qualifier.datavalue.value.language == 'el'
				) then
					return qualifier.datavalue.value.text
				end
			end
		end
	end
	mw.log("no data")
	return
end

return p