/********************************************************
+*   (c) Mojang. All rights reserved                       *
+*   (c) Microsoft. All rights reserved.                   *
+*********************************************************/

{
  "namespace": "add_external_server",

  "play_button@common_buttons.light_text_button": {
    "$pressed_button_name": "button.play_button",
    "$button_text": "addExternalServerScreen.playButtonLabel",
    "ignored": "$edit_mode",
    "bindings": [
      {
        "binding_name": "#play_button_enabled",
        "binding_name_override": "#enabled"
      }
    ]
  },

  "play_disabled_button@play_button": {
    "$text_color": "$light_button_locked_text_color",
    "bindings": [
      {
        "binding_name": "#play_button_disabled",
        "binding_name_override": "#visible"
      },
      {
        "binding_name": "#play_button_enabled",
        "binding_name_override": "#enabled"
      }
    ]
  },

  "remove_button@common_buttons.light_text_button": {
    "$pressed_button_name": "button.remove_button",
    "$button_text": "addExternalServerScreen.removeButtonLabel",
    "visible": "($edit_mode)"
  },

  "save_button@common_buttons.light_text_button": {
    "$pressed_button_name": "button.save_button",
    "$button_text": "addExternalServerScreen.saveButtonLabel",
    "bindings": [
      {
        "binding_name": "#save_button_enabled",
        "binding_name_override": "#visible"
      },
      {
        "binding_name": "#save_button_enabled",
        "binding_name_override": "#enabled"
      }
    ]
  },

  "save_disabled_button@save_button": {
    "$text_color": "$light_button_locked_text_color",
    "bindings": [
      {
        "binding_name": "#save_button_disabled",
        "binding_name_override": "#visible"
      },
      {
        "binding_name": "#save_button_enabled",
        "binding_name_override": "#enabled"
      }
    ]
  },

  "text_edit_group": {
    "type": "stack_panel",
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "size": [ "100%", "100%c+3px" ],
    "$max_length|default": 30,
    "$text_type|default": "ExtendedASCII",
    "controls": [
      {
        "name_label": {
          "type": "label",
          "color": "$sub_header_text_color",
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "layer": 1,
          "offset": [ 2, 0 ],
          "size": [ "100%", "10px" ],
          "text": "$header"
        }
      },
      {
        "edit_box@common.text_edit_box": {
          "layer": 2,
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "size": [ "100%", 25 ],
          "$text_box_name": "$text_box_name",
          "$text_edit_box_content_binding_name": "$content_binding_name",
          "max_length": "$max_length",
          "text_type": "$text_type",
          "$place_holder_text": "$placeholder_label",
          "$text_edit_box_binding_condition": "once"
        }
      }
    ]
  },

  "title_text": {
    "type": "label",
    "layer": 1,
    "text": "#title_text",
    "color": "$title_text_color",
    "shadow": false,
    "bindings": [
      {
        "binding_name": "#title_text",
        "binding_condition": "once"
      }
    ]
  },

  "content_panel": {
    "type": "stack_panel",
    "controls": [
      {
        "name_edit@add_external_server.text_edit_group": {
          "$header": "addExternalServerScreen.nameTextBoxLabel",
          "$placeholder_label": "addExternalServerScreen.namePlaceholder",
          "$text_box_name": "#name_text_box",
          "$max_length": 16,
          "$content_binding_name": "#name_text_box_content"
        }
      },
      {
        "ip_edit@add_external_server.text_edit_group": {
          "$header": "addExternalServerScreen.ipTextBoxLabel",
          "$placeholder_label": "addExternalServerScreen.ipPlaceholder",
          "$text_box_name": "#ip_text_box",
          "$max_length": 256,
          "$content_binding_name": "#ip_text_box_content"
        }
      },
      {
        "port_edit@add_external_server.text_edit_group": {
          "$header": "addExternalServerScreen.portTextBoxLabel",
          "$placeholder_label": "",
          "$max_length": 6,
          "$text_type": "NumberChars",
          "$text_box_name": "#port_text_box",
          "$content_binding_name": "#port_text_box_content"
        }
      }
    ]
  },

  "main_panel": {
    "type": "input_panel",
    "size": "$dialog_size",
    "controls": [
      {
        "common_panel@common.common_panel": {
          "$dialog_background": "dialog_background_hollow_2"
        }
      },
      {
        "title@add_external_server.title_text": {
          "offset": [ 10, 9 ],
          "size": [ "100%", 15 ],
          "anchor_to": "top_middle",
          "anchor_from": "top_middle"
        }
      },
      {
        "main_content@add_external_server.content_panel": {
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "size": [ "100%-21px", "100%-52px" ],
          "offset": [ 10, 24 ]
        }
      },
      {
        "play@add_external_server.play_button": {
          "size": [ "50%-8px", 30 ],
          "anchor_from": "bottom_left",
          "anchor_to": "bottom_left",
          "offset": [ 7, -7 ]
        }
      },
      {
        "play_disabled@add_external_server.play_disabled_button": {
          "ignored": "$edit_mode",
          "size": [ "50%-8px", 30 ],
          "anchor_from": "bottom_left",
          "anchor_to": "bottom_left",
          "offset": [ 7, -7 ],
          "layer": 5
        }
      },
      {
        "remove@add_external_server.remove_button": {
          "size": [ "50%-8px", 30 ],
          "anchor_from": "bottom_left",
          "anchor_to": "bottom_left",
          "offset": [ 7, -7 ]
        }
      },
      {
        "save@add_external_server.save_button": {
          "size": [ "50%-8px", 30 ],
          "anchor_from": "bottom_right",
          "anchor_to": "bottom_right",
          "offset": [ -7, -7 ]
        }
      },
      {
        "save_disabled@add_external_server.save_disabled_button": {
          "size": [ "50%-8px", 30 ],
          "anchor_from": "bottom_right",
          "anchor_to": "bottom_right",
          "offset": [ -7, -7 ],
          "layer": 1
        }
      }
    ]
  },

  "gamepad_helpers": {
    "type": "panel",
    "layer": 2,
    "controls": [
      {
        "gamepad_helper_a@common.gamepad_helper_a": {
          "anchor_from": "bottom_right",
          "anchor_to": "bottom_right"
        }
      }
    ]
  },

  // -----------------------------------------------
  //
  //    screen
  //
  // -----------------------------------------------
  "add_external_server_screen_new@add_external_server_screen": {
  },

  "add_external_server_screen_edit@add_external_server_screen": {
  },

  "add_external_server_screen@common.base_screen": {
    "$dialog_size": [ 316, 179 ],
    "button_mappings": [
      {
        "from_button_id": "button.menu_cancel",
        "to_button_id": "button.menu_exit",
        "mapping_type": "global"
      }      
    ],
    "$screen_content": "add_external_server.add_external_server_screen_content"
  },

  "add_external_server_screen_content": {
    "type": "panel",
    "controls": [
      {
        "root_panel": {
          "type": "panel",
          "controls": [
            { "gamepad_helpers@add_external_server.gamepad_helpers": {} },
            { "main_panel@add_external_server.main_panel": { "layer": 1 } }
          ]
        }
      }
    ]
  }
}