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

{
  "namespace": "xbl_friend_finder",

  "message_label": {
    "type": "label",
    "text": "$message_binding_name",
    "max_size": [ "100% - 4px", 20 ],
    "shadow": false,
    "offset": [ 0, 6 ],
    "anchor_from": "top_middle",
    "anchor_to": "top_middle",
    "color": "$dark_button_default_text_color",
    "layer": 3,
    "$message_binding_name|default": "",
    "bindings": [
      {
        "binding_name": "$message_binding_name",
        "binding_type": "global"
      }
    ]
  },
  
  "text_edit_panel": {
    "type": "panel",
    "size": [ "100%", 20 ],
    "controls": [
      {
        "text_edit_box@common.text_edit_box": {
          "$text_box_name": "gamertag_search_box",
          "$place_holder_text": "xbox.friendfinder.enterGamertag",
          "$text_edit_box_label_anchor_point": "left_middle",
          "$text_edit_box_label_offset": [ 2, 0 ],
          "$text_edit_box_label_size": [ "100% - 6px", 10 ],
          "max_length": 16,
          "layer": 1,
          "size": [ "100%", 20 ],
          "property_bag": {
            "#property_field": "#gamertag"
          },
          "button_mappings": [
            {
              "from_button_id": "button.menu_select",
              "to_button_id": "button.menu_select",
              "handle_select": true,
              "handle_deselect": false,
              "mapping_type": "pressed"
            },
            {
              "from_button_id": "button.menu_ok",
              "to_button_id": "button.menu_select",
              "handle_select": true,
              "handle_deselect": true,
              "mapping_type": "focused"
            },
            {
              "from_button_id": "button.menu_ok",
              "to_button_id": "button.search",
              "handle_select": false,
              "handle_deselect": true,
              "mapping_type": "focused"
            },
            {
              "from_button_id": "button.menu_cancel",
              "to_button_id": "button.menu_cancel",
              "handle_select": false,
              "handle_deselect": true,
              "mapping_type": "global"
            }
          ]
        }
      }
    ]
  },

  "main_panel": {
    "type": "stack_panel",
    "size": [ "100% - 4px", "100%c" ],
    "controls": [
      {
        "padding_0": {
          "type": "panel",
          "size": [ "100%", 2 ]
        }
      },
      {
        "find_friends_label": {
          "type": "label",
          "size": [ "100%", 10 ],
          "color": "$body_text_color",
          "layer": 1,
          "text": "xbox.friendfinder.findFriends"
        }
      },
      {
        "padding_1": {
          "type": "panel",
          "size": [ "100%", 2 ]
        }
      },
      {
        "text_edit_panel@xbl_friend_finder.text_edit_panel": {}
      },
      {
        "padding_2": {
          "type": "panel",
          "size": [ "100%", 6 ]
        }
      },
      {
        "searching_profile_panel": {
          "type": "image",
          "texture": "textures/ui/mainbanners",
          "size": [ "100%", 45 ],
          "controls": [
            {
              "searching_label@xbl_friend_finder.message_label": {
                "$message_binding_name": "#friend_finder_text"
              }
            },
            {
              "searching_bars@common_store.progress_loading_bars": {
                "offset": [ 0, 10 ],
                "anchor_from": "center",
                "anchor_to": "center",
                "bindings": [
                  {
                    "binding_name": "#search_in_progress",
                    "binding_name_override": "#visible"
                  }
                ]
              }
            }
          ],
          "bindings": [
            {
              "binding_name": "#message_panel_visible",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "padding_3": {
          "type": "panel",
          "size": [ "100%", 6 ]
        }
      }
    ]
  },

  "gamepad_helpers": {
    "type": "panel",
    "layer": 2,
    "controls": [
      {
        "gamepad_helper_a@common.gamepad_helper_a": {
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle",
          "offset": [ "-10%", "-5%" ]
        }
      },
      {
        "gamepad_helper_b@common.gamepad_helper_b": {
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle",
          "offset": [ "10%", "-5%" ]
        }
      }
    ]
  },

  // -----------------------------------------------
  //
  //    screen
  //
  // -----------------------------------------------
  "xbl_friend_finder@common.base_screen": {
    "button_mappings": [
      {
        "from_button_id": "button.menu_cancel",
        "to_button_id": "button.menu_exit",
        "mapping_type": "global"
      }
    ],
    "$screen_content": "xbl_friend_finder.xbl_friend_finder_screen_content"
  },

  "xbl_friend_finder_screen_content": {
    "type": "panel",
    "controls": [
      { "gamepad_helpers@xbl_friend_finder.gamepad_helpers": {} },
      {
        "dialog@xbl_friend_finder.dialog": {
          "layer": 1
        }
      }
    ]
  },

  "dialog@common_dialogs.form_fitting_main_panel_no_buttons": {
    "size": [ 250, "100%c" ],
    "offset": [ 0, "-20%" ],
    "$child_control": "xbl_friend_finder.main_panel",
    "$text_name": "xbox.profile.addFriend",
    "variables": [
      {
        "requires": "$nx_os",
        "$text_name": "networkWorld.find_cross_platform_friends"
      }
    ]
  }
}