{
    "$schema": "http://www.lavishsoft.com/schema/lgui2Package.json",
    "templates": {
        "ActorsWithTargetsView": {
            "jsonTemplate": "listboxitem",
            "padding": 2,
            "content": {
                "type": "stackpanel",
                "orientation": "horizontal",
                "children": [
                    {
                        "type": "textblock",
                        "width": 120,
                        "padding": 2,
                        "margin": [
                            0,
                            0,
                            2,
                            0
                        ],
                        "textBinding": {
                            "pullFormat": "${_CONTEXTITEMDATA_.Get[Name]}",
                            "pullReplaceNull": ""
                        }
                    },
                    {
                        "type": "textblock",
                        "width": 45,
                        "padding": 2,
                        "textBinding": {
                            "pullFormat": "@ ${_CONTEXTITEMDATA_.Get[Health]}%",
                            "pullReplaceNull": ""
                        }
                    },
                    {
                        "type": "textblock",
                        "width": 75,
                        "padding": 2,
                        "textBinding": {
                            "pullFormat": "on ${_CONTEXTITEMDATA_.Get[TargetName]}",
                            "pullReplaceNull": ""
                        }
                    },
                    {
                        "type": "textblock",
                        "width": 45,
                        "padding": 2,
                        "textBinding": {
                            "pullFormat": "T: ${_CONTEXTITEMDATA_.Get[ThreatToNext]}",
                            "pullReplaceNull": ""
                        }
                    },
                    {
                        "type": "textblock",
                        "width": 45,
                        "padding": 2,
                        "textBinding": {
                            "pullFormat": "D: ${_CONTEXTITEMDATA_.Get[Distance]}",
                            "pullReplaceNull": ""
                        }
                    }
                ]
            }
        }
    },
    "elements": [
        {
            "type": "panel",
            "visibility": "hidden",
            "name": "MrOSAController.events"
        },
        {
            "type": "window",
            "title": "OSA",
            "name": "mr.osa.window",
            "borderThickness": 2,
            "hideOnClose": false,
            "minSize": {
                "width": 175,
                "height": 200
            },
            "height": 200,
            "width": 350,
            "maxSize": {
                "width": 400,
                "height": 300
            },
            "backgroundBrush": {
                "color": [
                    0,
                    0,
                    0
                ]
            },
            "eventHandlers": {
                "onCloseButtonClick": [
                    "method",
                    "MrOSAController",
                    "OnClose"
                ]
            },
            "content": {
                "type": "stackpanel",
                "uniform": true,
                "heightFactor": 1,
                "font": {
                    "face": "Terminal",
                    "fixed": true,
                    "height": 10
                },
                "children": [
                    {
                        "type": "listbox",
                        "name": "mobs",
                        "verticalAlignment": "stretch",
                        "horizontalAlignment": "stretch",
                        "itemsBinding": {
                            "pullFormat": "${MrOSAController.ActorsWithTarget.AsJSON[array]}",
                            "pullHook": {
                                "elementName": "MrOSAController.events",
                                "flags": "global",
                                "event": "onUpdateActors"
                            }
                        },
                        "eventHandlers": {
                            "onSelectionChanged": [
                                "method",
                                "MrOSAController",
                                "OnChangeTarget"
                            ]
                        },
                        "selectedItemBinding": {
                            "pushFormat": [
                                "MrOSAController.SelectedItem:Set[\"",
                                "\"]"
                            ],
                            "pullFormat": "${MrOSAController.selectedItem}"
                        },
                        "selectedItemBindingProperty": "ID",
                        "itemViewGenerators": {
                            "default": {
                                "type": "template",
                                "template": "ActorsWithTargetsView"
                            }
                        }
                    }
                ]
            }
        }
    ]
}