%{
--------------------------------------------------------------------------------
--
--  This file is part of the Doxyrest toolkit.
--
--  Doxyrest is distributed under the MIT license.
--  For details see accompanying license.txt file,
--  the public copy of which is also available at:
--  http://tibbo.com/downloads/archive/doxyrest/license.txt
--
--------------------------------------------------------------------------------

local argArray = table.pack(...)
local enum = argArray[1]

local enumKind = getItemKindString(enum, "enum")
local enumStats = prepareEnum(enum)

if FORCE_INCLUDE_FILE then
}
.. include:: $FORCE_INCLUDE_FILE
%{
end -- if
}
.. index:: pair: enum; $(enum.name)
.. _doxid-$(enum.id):

$(getTitle(enumKind .. " " .. getItemQualifiedName(enum), 1))

%{
local hasDetails =
	enumStats.hasDocumentedEnumValues or
	enumStats.hasBriefDocumentation and enumStats.hasDetailedDocumentation

if hasDetails then
}
Overview
~~~~~~~~

$(getItemBriefDocumentation(enum))

%{
else
}
$(getItemDetailedDocumentation(enum))

%{
end -- if
}
.. ref-code-block:: $LANGUAGE
	:class: doxyrest-overview-code-block

	$(getEnumImportString(enum))
	$enumKind $(enum.name)$g_preBodySpace{
%{
for i = 1, #enum.enumValueArray do
	local item = enum.enumValueArray[i]
	local initializer = getLinkedTextString(item.initializer, true)

	if string.len(initializer) > 0 then
		local spaceCount = enumStats.maxEnumValueNameLength - string.len(item.name) + 1
		initializer = string.rep(" ", spaceCount) .. initializer
	end
}
	    $(getItemNameForOverview(item))$initializer,
%{
end -- for
}
	};

%{
if hasDetails then
}
.. _details-$(enum.id):

Detailed Documentation
~~~~~~~~~~~~~~~~~~~~~~

$(getItemDetailedDocumentation(enum))

%{
end -- if

if enumStats.hasDocumentedEnumValues then
}
Enum Values
-----------

%{
	for i = 1, #enum.enumValueArray do
		local item = enum.enumValueArray[i]
		if item.hasDocumentation then
}
$(getItemRefTargetString(item))
.. ref-code-block:: $LANGUAGE
	:class: doxyrest-title-code-block

	$(item.name)
%{
		if item.isSubGroupHead then
			for j = 1, #item.subGroupSlaveArray do
				slaveItem = item.subGroupSlaveArray[j]
}
	$(slaveItem.name)
%{
			end -- for
		end -- if
}

$(getItemDetailedDocumentation(item))

%{
		end -- if
	end -- for
end -- if
}
