
local category = "UI Elements";

table.insert(GHI_ProvidedDynamicActions, {
	name = "Setup Slash Command",
	guid = "slash_01",
	authorName = "The Gryphonheart Team",
	authorGuid = "00x1",
	version = 1,
	category = category,
	description = "Sets up a custom slash command.",
	icon = "Interface\\Icons\\INV_Misc_Note_04",
	gotOnSetupPort = true,
	setupOnlyOnce = true,
	allowedInUpdateSequence = false,
	script =
	[[  local cmdPrefix = dyn.GetInput("cmdPrefix");
		local slashCmdHandler = GHI_SlashCmd(cmdPrefix);
	    slashCmdHandler.SetDefaultFunc(function(cmd)
	    	dyn.SetOutput("cmd",cmd);
	    	dyn.TriggerOutPort("cmdEntered");
	    end)
	]],
	ports = {
		cmdEntered = {
			name = "Slash Command entered",
			direction = "out",
			order = 1,
			description = "Fired when a command is entered.",
		},
	},
	inputs = {
		cmdPrefix = {
			name = "Slash prefix",
			description = "The /prefix that should be reacted to.(Such as /test)",
			type = "string",
			defaultValue = "",
		},
	},
	outputs = {
		cmd = {
			name = "Command",
			description = "The command entered",
			type = "string",
		},
	},
});


table.insert(GHI_ProvidedDynamicActions, {
	name = "Cast bar",
	guid = "cast_01",
	authorName = "The Gryphonheart Team",
	authorGuid = "00x1",
	version = 1,
	category = category,
	description = "Displays the cast bar.",
	icon = "Interface\\Icons\\INV_Misc_Note_01",
	gotOnSetupPort = true,
	setupOnlyOnce = false,
	allowedInUpdateSequence = false,
	script =
	[[
		local castBar = GHI_CastBarUI();
	    castBar.Cast(
	    	dyn.GetInput("name"),
	    	dyn.GetInput("icon"),
	        dyn.GetInput("duration"),
	        function() dyn.TriggerOutPort("finished") end,
	        function() dyn.TriggerOutPort("interrupted") end
	    );
	]],
	ports = {
		finished = {
			name = "Finished",
			direction = "out",
			order = 1,
			description = "Fired when the casting is done.",
		},
		interrupted = {
			name = "Interrupted",
			direction = "out",
			order = 2,
			description = "Fired if the casting is interrupted.",
		},
	},
	inputs = {
		name = {
			name = "Spell name",
			description = "The spell or ability name.",
			type = "string",
			defaultValue = "",
			order = 1,
		},
		icon = {
			name = "Spell icon",
			description = "The spell or ability name.",
			type = "icon",
			defaultValue = "",
			order = 2,
		},
		duration = {
			name = "Cast duration",
			description = "The spell or ability duration.",
			type = "time",
			defaultValue = 1,
			order = 3,
		},
	},
	outputs = {
	},
});