-- See LICENSE for terms

local default_passage_palette = {"none", "none", "none", "none"}

-- add our "skin"
local ChoOrig_Passage_GetSkins = Passage.GetSkins
function Passage:GetSkins(...)
	local skins, palettes = ChoOrig_Passage_GetSkins(self,...)
	skins[#skins+1] = "ChoGGi_MinimalPassageSkin"
	palettes[#palettes+1] = default_passage_palette
	return skins, palettes
end

--	happens when our "skin" is choosen
local ChoOrig_Passage_ChangeSkin = Passage.ChangeSkin
function Passage:ChangeSkin(skin, ...)
	self.skin_id = skin
	if skin == "ChoGGi_MinimalPassageSkin" then
		local realm = self:GetRealm() or GetActiveRealm()
		realm:SuspendPassEdits("ChoGGi.MinimalPassageSkin.ChangeSkin")
		for i = 1, #self.elements do
			local element = self.elements[i]
			if element ~= self.start_el and element ~= self.end_el then
				element:ChangeEntity("InvisibleObject")
			end
		end
		realm:ResumePassEdits("ChoGGi.MinimalPassageSkin.ChangeSkin")
	else
		return ChoOrig_Passage_ChangeSkin(self, skin, ...)
	end
end
