{
  "$schema": "http://www.lavishsoft.com/schema/lgui2Package.json",
  "skin": "MRSkin",
  "templates": {
    "settings.abilityListEntry": {
      "jsonTemplate": "listboxitem",
      "padding": 2,
      "content": {
        "type": "stackpanel",
        "orientation": "vertical",
        "-contentContainer": {
          "jsonTemplate": "listbox.contentContainerFitWidth"
        },
        "children": [
          {
            "type": "textblock",
            "horizontalAlignment": "stretch",
            "textBinding": {
              "pullFormat": "${_CONTEXTITEMDATA_.Get[name]}"
            }
          }
        ]
      }
    },
    "settings.castStack": {
      "orientation": "vertical",

      "children": [
        {
          "type": "panel",
          "visibility": "hidden",
          "name": "MRSettingsController.events"
        },
        {
          "type": "stackpanel",
          "orientation": "horizontal",
          "heightFactor": 0.9,
          "widthFactor": 1,
          "horizontalAlignment": "left",
          "children": [
            {
              "type": "stackpanel",
              "orientation": "vertical",
              "widthFactor": 0.3,
              "margin": [0, 0, 5, 0],
              "children": [
                {
                  "type": "textblock",
                  "text": "Ability List",
                  "widthFactor": 1,
                  "horizontalAlignment": "left"
                },
                {
                  "type": "listbox",
                  "name": "abilityList",
                  "heightFactor": 0.9,
                  "itemsBinding": {
                    "pullFormat": "${MRSettingsController.abilityListItems}",
                    "pullOnce": true
                  },
                  "itemViewGenerators": {
                    "default": {
                      "type": "template",
                      "template": "settings.abilityListEntry"
                    }
                  },
                  "selectedItemBinding": {
                    "pullFormat": "${MRSettingsController.currentSelectedAvailableAbilityIndex}",
                    "pushFormat": [
                      "MRSettingsController:SetCurrentAbility[\"",
                      "\"]"
                    ]
                  },
                  "-contentContainer": {
                    "jsonTemplate": "listbox.contentContainerFitWidth"
                  }
                },
                {
                  "type": "button",
                  "name": "castStack.addAbility",
                  "content": "Add Ability",
                  "horizontalAlignment": "stretch",
                  "eventHandlers": {
                    "onRelease": [
                      "method",
                      "MRSettingsController",
                      "AddAbility"
                    ]
                  }
                }
              ]
            },
            {
              "type": "stackpanel",
              "orientation": "vertical",
              "widthFactor": 0.3,
              "heightFactor": 1,
              "verticalAlignment": "top",
              "margin": [0, 0, 5, 0],
              "padding": [0, 16, 0, 0],
              "children": [
                {
                  "type": "stackpanel",
                  "orientation": "horizontal",
                  "margin": [0, 0, 0, 5],
                  "children": [
                    {
                      "type": "textblock",
                      "text": "Type",
                      "width": 60
                    },
                    {
                      "type": "combobox",
                      "name": "castStack.ability.type",
                      "horizontalAlignment": "stretch",
                      "items": [
                        "Combat",
                        "CA",
                        "NamedCA",
                        "Heal",
                        "PowerHeal",
                        "Debuff",
                        "NamedDebuff",
                        "NonCombatBuff",
                        "Cure",
                        "Buff"
                      ],
                      "selectedItemBinding": {
                        "pullFormat": "${MRSettingsController.newCastStackItem.Get[type]}",
                        "autoPull": false,
                        "pullHook": {
                          "elementName": "MRSettingsController.events",
                          "flags": "global",
                          "event": "onNewCastStackItemChanged"
                        }
                      },
                      "eventHandlers": {
                        "onSelectionChanged": {
                          "type": "method",
                          "object": "MRSettingsController",
                          "method": "OnCastStackAbilityComboChange"
                        }
                      }
                    }
                  ]
                },
                {
                  "type": "stackpanel",
                  "orientation": "horizontal",
                  "margin": [0, 0, 0, 5],
                  "children": [
                    {
                      "type": "textblock",
                      "text": "Target",
                      "width": 60
                    },
                    {
                      "type": "combobox",
                      "name": "castStack.ability.target",
                      "horizontalAlignment": "stretch",
                      "itemsBinding": {
                        "pullFormat": "${MRSettingsController.GetTargetOptions}",
                        "pullOnce": true
                      },
                      "selectedItemBinding": {
                        "pullFormat": "${MRSettingsController.newCastStackItem.Get[target]}",
                        "autoPull": false,
                        "pullHook": {
                          "elementName": "MRSettingsController.events",
                          "flags": "global",
                          "event": "onNewCastStackItemChanged"
                        }
                      },
                      "eventHandlers": {
                        "onSelectionChanged": {
                          "type": "method",
                          "object": "MRSettingsController",
                          "method": "OnCastStackAbilityComboChange"
                        }
                      }
                    }
                  ]
                },
                {
                  "type": "stackpanel",
                  "orientation": "horizontal",
                  "margin": [0, 0, 0, 5],
                  "children": [
                    {
                      "type": "textblock",
                      "text": "# targets",
                      "width": 60
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.ability.targetCount",
                      "horizontalAlignment": "stretch",
                      "textBinding": {
                        "pullFormat": "${MRSettingsController.SafeGetNewCastStackItemProperty[targetCount]}",
                        "autoPull": false,
                        "pullHook": {
                          "elementName": "MRSettingsController.events",
                          "flags": "global",
                          "event": "onNewCastStackItemChanged"
                        },
                        "pushFormat": [
                          "MRSettingsController:SafeSetNewCastStackItemProperty[\"targetCount\",\"",
                          "\"]"
                        ],
                        "autoPush": false
                      },
                      "hooks": {
                        "onLostFocus": {
                          "flags": "self",
                          "event": "lostKeyboardFocus",
                          "eventHandler": {
                            "type": "forward",
                            "event": "pushTextBinding",
                            "flags": "self"
                          }
                        },
                        "onLostMouseFocus": {
                          "flags": "self",
                          "event": "lostMouseFocus",
                          "eventHandler": {
                            "type": "forward",
                            "event": "pushTextBinding",
                            "flags": "self"
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "type": "stackpanel",
                  "orientation": "horizontal",
                  "children": [
                    {
                      "type": "textblock",
                      "text": "HP/MP %",
                      "width": 60
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.percent",
                      "horizontalAlignment": "stretch",
                      "textBinding": {
                        "pullFormat": "${MRSettingsController.SafeGetNewCastStackItemProperty[percent]}",
                        "autoPull": false,
                        "pullHook": {
                          "elementName": "MRSettingsController.events",
                          "flags": "global",
                          "event": "onNewCastStackItemChanged"
                        },
                        "pushFormat": [
                          "MRSettingsController:SafeSetNewCastStackItemProperty[\"percent\",\"",
                          "\"]"
                        ],
                        "autoPush": false
                      },
                      "hooks": {
                        "onLostFocus": {
                          "flags": "self",
                          "event": "lostKeyboardFocus",
                          "eventHandler": {
                            "type": "forward",
                            "event": "pushTextBinding",
                            "flags": "self"
                          }
                        },
                        "onLostMouseFocus": {
                          "flags": "self",
                          "event": "lostMouseFocus",
                          "eventHandler": {
                            "type": "forward",
                            "event": "pushTextBinding",
                            "flags": "self"
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "type": "checkbox",
                  "name": "castStack.ignoreDuration",
                  "content": "Ignore Duration",
                  "horizontalAlignment": "stretch",
                  "margin": [2, 10, 0, 0]
                },
                {
                  "type": "checkbox",
                  "name": "castStack.ignoreEncounterNukes",
                  "content": "Ignore Encounter Nukes",
                  "horizontalAlignment": "stretch"
                },
                {
                  "type": "checkbox",
                  "name": "castStack.ignoreAENukes",
                  "content": "Ignore AE Nukes",
                  "horizontalAlignment": "stretch"
                },
                {
                  "type": "checkbox",
                  "name": "castStack.maxIncrements",
                  "content": "Max Increments",
                  "horizontalAlignment": "stretch"
                },
                {
                  "type": "checkbox",
                  "name": "castStack.namedOnly",
                  "content": "Named Only",
                  "horizontalAlignment": "stretch"
                },
                {
                  "type": "stackpanel",
                  "orientation": "horizontal",
                  "horizontalAlignment": "stretch",
                  "margin": [0, 10, 0, 5],
                  "children": [
                    {
                      "type": "textblock",
                      "text": "Fervor",
                      "width": 70
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.fervorRangeMin",
                      "width": 30
                    },
                    {
                      "type": "textblock",
                      "text": "-",
                      "font": {
                        "bold": true,
                        "height": 24
                      },
                      "margin": [5, 0, 0, 0],
                      "width": 10
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.fervorRangeMax",
                      "width": 30
                    }
                  ]
                },

                {
                  "type": "stackpanel",
                  "orientation": "horizontal",
                  "horizontalAlignment": "stretch",
                  "margin": [0, 0, 0, 5],
                  "children": [
                    {
                      "type": "textblock",
                      "text": "Dissonance",
                      "width": 70
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.dissonanceRangeMin",
                      "width": 30
                    },
                    {
                      "type": "textblock",
                      "text": "-",
                      "font": {
                        "bold": true,
                        "height": 24
                      },
                      "margin": [5, 0, 0, 0],
                      "width": 10
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.dissonanceRangeMax",
                      "width": 30
                    }
                  ]
                },

                {
                  "type": "stackpanel",
                  "orientation": "horizontal",
                  "horizontalAlignment": "stretch",
                  "margin": [0, 0, 0, 5],
                  "children": [
                    {
                      "type": "textblock",
                      "text": "My HP",
                      "width": 70
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.myHpRangeMin",
                      "width": 30
                    },
                    {
                      "type": "textblock",
                      "text": "-",
                      "font": {
                        "bold": true,
                        "height": 24
                      },
                      "margin": [5, 0, 0, 0],
                      "width": 10
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.myHpRangeMax",
                      "width": 30
                    }
                  ]
                },

                {
                  "type": "stackpanel",
                  "orientation": "horizontal",
                  "horizontalAlignment": "stretch",
                  "margin": [0, 0, 0, 5],
                  "children": [
                    {
                      "type": "textblock",
                      "text": "My Power",
                      "width": 70
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.myPowerRangeMin",
                      "width": 30
                    },
                    {
                      "type": "textblock",
                      "text": "-",
                      "font": {
                        "bold": true,
                        "height": 24
                      },
                      "margin": [5, 0, 0, 0],
                      "width": 10
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.myPowerRangeMax",
                      "width": 30
                    }
                  ]
                },

                {
                  "type": "stackpanel",
                  "orientation": "horizontal",
                  "horizontalAlignment": "stretch",
                  "margin": [0, 0, 0, 5],
                  "children": [
                    {
                      "type": "textblock",
                      "text": "NPC HP",
                      "width": 70
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.npcHpRangeMin",
                      "width": 30
                    },
                    {
                      "type": "textblock",
                      "text": "-",
                      "font": {
                        "bold": true,
                        "height": 24
                      },
                      "margin": [5, 0, 0, 0],
                      "width": 10
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.npcHpRangeMax",
                      "width": 30
                    }
                  ]
                },

                {
                  "type": "stackpanel",
                  "orientation": "horizontal",
                  "horizontalAlignment": "stretch",
                  "margin": [0, 0, 0, 5],
                  "children": [
                    {
                      "type": "textblock",
                      "text": "Aggro",
                      "width": 70
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.aggroRangeMin",
                      "width": 30
                    },
                    {
                      "type": "textblock",
                      "text": "-",
                      "font": {
                        "bold": true,
                        "height": 24
                      },
                      "margin": [5, 0, 0, 0],
                      "width": 10
                    },
                    {
                      "type": "textbox",
                      "name": "castStack.aggroRangeMax",
                      "width": 30
                    }
                  ]
                }
              ]
            },
            {
              "type": "stackpanel",
              "orientation": "vertical",
              "widthFactor": 1,
              "heightFactor": 1,
              "children": [
                {
                  "type": "textblock",
                  "text": "Cast Order",
                  "widthFactor": 1,
                  "horizontalAlignment": "left"
                },
                {
                  "type": "listbox",
                  "name": "castStack.castOrder",
                  "horizontalAlignment": "stretch",
                  "heightFactor": 0.9,
                  "itemsBinding": {
                    "pullFormat": "${MRSettingsController.profile.Get[castStack].Keys}"
                  }
                },
                {
                  "type": "button",
                  "name": "castStack.castOrder.edit",
                  "content": "Edit Entry",
                  "horizontalAlignment": "stretch",
                  "eventHandlers": {
                    "onRelease": ["method", "MRSettingsController", "EditEntry"]
                  }
                }
              ]
            }
          ]
        },
        {
          "type": "stackpanel",
          "orientation": "horizontal",
          "verticalAlignment": "stretch",
          "horizontalAlignment": "stretch",

          "children": [
            {
              "type": "stackpanel",
              "orientation": "vertical",
              "verticalAlignment": "stretch",
              "horizontalAlignment": "left",
              "children": [
                {
                  "type": "button",
                  "name": "castStack.loadProfile",
                  "content": "Load Profile",
                  "horizontalAlignment": "left"
                },
                {
                  "type": "combobox",
                  "name": "castStack.profileList",
                  "horizontalAlignment": "left",
                  "itemsBinding": {
                    "pullFormat": "${MRSettingsController.ProfileList}",
                    "autoPull": true,
                    "pullHook": {
                      "elementName": "MRSettingsController.events",
                      "flags": "global",
                      "event": "onProfileListChanged"
                    }
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  }
}
