/********************************************************
+*   (c) Mojang. All rights reserved                       *
+*   (c) Microsoft. All rights reserved.                   *
+*********************************************************/

{
  "namespace": "xbl_console_qr_signin",

  "banner_fill": {
    "type": "image",
    "texture": "textures/ui/Banners",
    "size": [ "90%", "100%c + 6px" ]
  },

  "main_panel_qr": {
    "type": "stack_panel",
    "size": [ "100% - 4px", "50%x - 4px" ],
    "orientation": "horizontal",
    "controls": [
      {
        "left_panel@xbl_console_qr_signin.left_panel": {}
      },
      {
        "divider@common.vertical_divider": {
          "size": [ 8, "100%" ],
          "anchor_from": "top_middle",
          "anchor_to": "top_middle"
        }
      },
      {
        "right_panel": {
          "type": "stack_panel",
          "size": [ "50% - 6px", "100%" ],
          "orientation": "vertical",

          "controls": [
            {
              "scrolling_panel_sizer": {
                "type": "panel",
                "size": [ "100%", "fill" ],
                "controls": [
                  {
                    "right_scroll_panel@xbl_console_qr_signin.scroll_content_focus_border": {}
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  },

  "common_scrolling_panel@common.scrolling_panel": {
    "layer": 1,
    "$scrolling_pane_size": [ "100%", "100%" ],
    "$scrolling_content": "xbl_console_qr_signin.input_panel_wrapper",
    "$scroll_size": [ 5, "100% - 4px" ],
    "$show_background": false,
    "anchor_from": "top_right",
    "anchor_to": "top_right"
  },

  "gamepad_helpers": {
    "type": "panel",
    "layer": 2,
    "controls": [
      {
        "gamepad_helper_b@common.gamepad_helper_b": {
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle",
          "offset": [ 0, -5 ]
        }
      }
    ]
  },

  // -----------------------------------------------
  //
  //    screen
  //
  // -----------------------------------------------
  "xbl_console_qr_signin@common.base_screen": {
    "button_mappings": [
      {
        "from_button_id": "button.menu_cancel",
        "to_button_id": "button.menu_exit",
        "mapping_type": "global"
      }
    ],
    "$screen_content": "xbl_console_qr_signin.xbl_console_qr_signin_screen_content"
  },

  "xbl_console_qr_signin_screen_content": {
    "type": "panel",
    "controls": [
      { "gamepad_helpers@xbl_console_qr_signin.gamepad_helpers": {} },
      {
        "dialog@xbl_console_qr_signin.dialog": {
          "layer": 1,
          "offset": [ 0, -10 ]
        }
      }
    ]
  },

  "dialog@common_dialogs.form_fitting_main_panel_no_buttons": {
    "size": "$xbl_console_qr_signin_screen_size",
    "$child_control": "xbl_console_qr_signin.main_panel_qr",
    "$text_name": "xbox.signin.qr"
  },

  "scroll_content_focus_border@common.non_interact_focus_border_button": {
    "$content_inside": "xbl_console_qr_signin.common_scrolling_panel",
    "$border_size": [ "100%", "100%sm + 2px" ],
    "size": [ "100%", "100%" ]
  },

  // -----------------------------------------------
  //
  //    panels
  //
  // -----------------------------------------------
  "left_panel": {
    "type": "stack_panel",
    "size": [ "50% - 6px", "100%" ],
    "orientation": "vertical",
    "controls": [
      {
        "left_header@common.minecraftTenLabel": {
          "size": [ "100%", 12 ],
          "text": "xbox.signin.qr.left.header",
          "layer": 2,
          "text_alignment": "left"
        }
      },
      {
        "padding_1": {
          "type": "panel",
          "size": [ "100%", 4 ]
        }
      },
      {
        "left_body": {
          "type": "label",
          "size": [ "100%", "default" ],
          "text": "xbox.signin.qr.left.body",
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "layer": 2,
          "text_alignment": "left",
          "color": "$xbl_signin_text_color",
          "font_type": "smooth"
        }
      },
      {
        "padding_2": {
          "type": "panel",
          "size": [ "100%", 6 ]
        }
      },
      {
        "qr_panel": {
          "type": "panel",
          "size": [ "100%", "fill" ],
          "controls": [
            {
              "qr_border": {
                "type": "image",
                "texture": "textures/ui/White",
                "keep_ratio": false,
                "anchor_to": "center",
                "anchor_from": "center",
                "size": [ "47% + 8px", "100%x" ],
                "layer": 1
              }
            },
            {
              "qr_code": {
                "type": "custom",
                "renderer": "qr_code_renderer",
                "size": [ "47%", "100%x" ],
                "anchor_to": "center",
                "anchor_from": "center",
                "layer": 2,
                "bindings": [
                  {
                    "binding_name": "#qr_code_content"
                  }
                ]
              }
            },
            {
              "bee_overlay": {
                "type": "image",
                "texture": "textures/ui/qr_code_bees",
                "size": [ "95%", "100%x" ],
                "offset": [ 10, 2 ],
                "anchor_to": "bottom_left",
                "anchor_from": "bottom_left",
                "layer": 100,
                "bilinear": true
              }
            }
          ]
        }
      }
    ]
  },

  "input_panel_wrapper": {
    "type": "input_panel",
    "focus_enabled": true,
    "size": [ "100%", "100%c" ],
    "controls": [
      {
        "r_scroll_panel@xbl_console_qr_signin.right_scroll_panel": {}
      }
    ]
  },

  "right_scroll_panel": {
    "type": "stack_panel",
    "size": [ "100%", "100%c" ],
    "orientation": "vertical",
    "controls": [
      {
        "right_header@common.minecraftTenLabel": {
          "size": [ "100%", 12 ],
          "text": "xbox.signin.qr.right.header",
          "layer": 2,
          "text_alignment": "left"
        }
      },
      {
        "padding_1": {
          "type": "panel",
          "size": [ "100%", 4 ]
        }
      },
      {
        "website_message_label": {
          "type": "label",
          "size": [ "100%", 10 ],
          "text": "xbox.signin.website.qr",
          "layer": 2,
          "text_alignment": "left",
          "color": "$xbl_signin_text_color",
          "font_type": "smooth"
        }
      },
      {
        "padding_2": {
          "type": "panel",
          "size": [ "100%", 4 ]
        }
      },
      {
        "wrapper_panel_1": {
          "type": "panel",
          "size": [ "100%", 16 ],
          "controls": [
            {
              "banner_1@xbl_console_qr_signin.banner_fill": {
                "layer": 1,
                "anchor_from": "center",
                "anchor_to": "center",
                "controls": [
                  {
                    "url_label": {
                      "type": "label",
                      "size": [ "100%", "default" ],
                      "text": "#url",
                      "layer": 2,
                      "text_alignment": "center",
                      "color": "$xbl_signin_text_color",
                      "font_type": "smooth",
                      "font_scale_factor": 1.2,
                      "bindings": [
                        {
                          "binding_name": "#url"
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "padding_3": {
          "type": "panel",
          "size": [ "100%", 4 ]
        }
      },
      {
        "code_message_label": {
          "type": "label",
          "size": [ "100%", "default" ],
          "text": "xbox.signin.enterCode.qr",
          "layer": 2,
          "text_alignment": "left",
          "color": "$xbl_signin_text_color",
          "font_type": "smooth"
        }
      },
      {
        "padding_4": {
          "type": "panel",
          "size": [ "100%", 4 ]
        }
      },
      {
        "wrapper_panel_2": {
          "type": "panel",
          "size": [ "100%", 16 ],
          "controls": [
            {
              "banner_2@xbl_console_qr_signin.banner_fill": {
                "anchor_from": "center",
                "anchor_to": "center",
                "layer": 1,
                "controls": [
                  {
                    "code_label": {
                      "type": "label",
                      "size": [ "100%", "default" ],
                      "text": "#code",
                      "layer": 2,
                      "text_alignment": "center",
                      "color": "$xbl_signin_text_color",
                      "font_type": "smooth",
                      "font_scale_factor": 1.3,
                      "bindings": [
                        {
                          "binding_name": "#code"
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "padding_5": {
          "type": "panel",
          "size": [ "100%", 4 ]
        }
      },
      {
        "code_message_body1": {
          "ignored": "((not $nx_os) or (not $is_nx_link_unlink_enabled))",
          "type": "label",
          "size": [ "100%", "default" ],
          "text": "xbox.signin.rightpanel.body1",
          "layer": 2,
          "text_alignment": "left",
          "color": "$xbl_signin_text_color",
          "font_type": "smooth"
        }
      },
      {
        "padding_6": {
          "type": "panel",
          "size": [ "100%", 4 ]
        }
      },
      {
        "code_message_body2": {
          "ignored": "((not $nx_os) or (not $is_nx_link_unlink_enabled))",
          "type": "label",
          "size": [ "100%", "default" ],
          "text": "xbox.signin.rightpanel.body2",
          "layer": 2,
          "text_alignment": "left",
          "color": "$xbl_signin_text_color",
          "font_type": "smooth"
        }
      },
      {
        "padding_7": {
          "type": "panel",
          "size": [ "100%", 18 ]
        }
      },
      {
        "warning_messages@xbl_console_qr_signin.ps4_warning_message_panel": {}
      }
    ]
  },

  "ps4_warning_message_panel": {
    "type": "stack_panel",
    "size": [ "100%", "100%c" ],
    "visible": "#ps4_warning_message_visible",
    "bindings": [
      {
        "binding_name": "#ps4_warning_message_visible",
        "binding_name_override": "#visible"
      }
    ],
    "controls": [
      {
        "sign_in_account_message": {
          "type": "label",
          "size": [ "100%", "default" ],
          "text": "xbox.signin.qr.account",
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "layer": 2,
          "text_alignment": "left",
          "color": "$xbl_signin_text_color",
          "font_type": "smooth",
          "font_scale_factor": 0.8
        }
      },
      {
        "padding_1": {
          "type": "panel",
          "size": [ "100%", 10 ]
        }
      },
      {
        "permanent_linking_message": {
          "type": "label",
          "size": [ "100%", "default" ],
          "text": "xbox.signin.message",
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "layer": 2,
          "text_alignment": "left",
          "color": "$xbl_signin_text_color",
          "font_type": "smooth",
          "font_scale_factor": 0.8
        }
      }
    ]
  }
}
