{
	"$id": "schema:UIElement",
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"title": "UIElement",
	"alias": "container",
	"type": "object",
	"properties": {
		"hoverText": {
			"type": "string",
			"description": "Text to show when hovering"
		},
		"type": {
			"type": "string",
			"description": "Classname of element",
			"dontDeclare": true
		},
		"name": {
			"type": "string",
			"description": "addressable name of element"
		},
		"elements":
    	{
	        "description": "Child elements of this element",
	        "type":"array",
			"dontDeclare": true,
	        "items":{
	            "$ref": "#"
	        }
    	},
		"isGlobal": {
			"type": "boolean",
			"description": "if this element is in the global namespace"
		},
		"isVisible": {
			"type": "boolean",
			"description": "if this element should be visible",
			"bitflag": "UIFLAG::HIDE",
			"inverted": true,
			"flagfield": "flags"
		},
		"isStretched": {
			"type": "boolean",
			"description": "if this element should fill its parent",
			"bitflag": "UIFLAG::STRETCH",
			"flagfield": "flags"
		},
		"origin": {
			"description": "origin in vpixels, offset by our parent (or the screen, if we don't have a parent)",
			"type": "array",
			"items": {
				"type": "number"
			},
			"maxItems": 2,
			"minItems": 2
		},
		"size": {
			"description": "size in vpixels of our UI element",
			"type": "array",
			"items": {
				"type": "number"
			},
			"maxItems": 2,
			"minItems": 2
		},
		"justify": {
			"description": "justify, basically just an automatic offset by our size, default is 0,0 which means our element will always be top-left aligned. 0.5,0 is top-center aligned",
			"type": "array",
			"items": {
				"type": "number"
			},
			"maxItems": 2,
			"minItems": 2
		},
		"anchor": {
			"description": "anchor within our parent, default is 0,0 or top left",
			"type": "array",
			"items": {
				"type": "number"
			},
			"maxItems": 2,
			"minItems": 2
		},
		"color": {
			"description": "color 0,0,0-1,1,1 RGB, default 1,1,1",
			"type": "array",
			"items": {
				"type": "number"
			},
			"maxItems": 3,
			"minItems": 3
		},
		"alpha": {
			"description": "alpha 0-1, default 1.0",
			"type": "number",
			"minimum": 0,
			"maxiumum": 1
		},
		"mod_col": {
			"description": "color multiplier, default 1.0",
			"type": "number",
			"minimum": 0,
			"maxiumum": 1
		},
		"mod_alp": {
			"description": " alpha multiplier, default 1.0",
			"type": "number",
			"minimum": 0,
			"maxiumum": 1
		},
		"onClick": {
			"type": "event",
			"description": "triggered upon click"
		},
		"onUnclick": {
			"type": "event",
			"description": "triggered when this was selected, but another element was clicked"
		},
		"onHover": {
			"type": "event",
			"description": "triggered when this is the primary element the cursor is above"
		},
		"onUnhover": {
			"type": "event",
			"description": "triggered when this element is nolonger the highlighted element"
		},
		"onTick": {
			"type": "event",
			"description": "triggered every frame"
		}
	},
	"commands": {
		"setProperty": {
			"description": "sets the value of a property",
			"minArguments": 2,
			"maxArguments": 2,
			"argumentLayout": ["string", "string"],
			"argumentHints": ["property", "value"]
		},
		"toggleVisible": {
			"description": "toggles visibility of this element",
			"minArguments": 0,
			"maxArguments": 0
		},
		"highlight": {
			"description": "raises alpha and color multiplier",
			"minArguments": 0,
			"maxArguments": 0
		},
		"unhighlight": {
			"description": "resets alpha and color multiplier",
			"minArguments": 0,
			"maxArguments": 0
		},
		"executeCommand": {
			"description": "executes a console command generically",
			"minArguments": 1,
			"maxArguments": 1,
			"argumentLayout": ["string"],
			"argumentHints": ["command string"]
		},
		"playSound": {
			"description": "plays a sound on this element's sound channel",
			"minArguments": 1,
			"maxArguments": 3,
			"argumentLayout": ["string", "number", "number"],
			"argumentHints": ["sample", "channel", "volume"]
		}
	}
}
