/********************************************************
+*   (c) Mojang. All rights reserved                       *
+*   (c) Microsoft. All rights reserved.                   *
+*********************************************************/

{
  "namespace": "bundle_purchase_warning",

  "x_padding": {
    "type": "panel",
    "size": [ 4, "100%" ]
  },

  "y_padding": {
    "type": "panel",
    "size": [ "100%", 2 ]
  },

  "bundle_grid_item": {
    "type": "panel",
    "size": [ "100%", 22 ],
    "controls": [
      {
        "banner_image": {
          "type": "image",
          "texture": "textures/ui/store_banner_no_border",
          "layer": 1,
          "bindings": [
            {
              "binding_name": "#banner_visible",
              "binding_name_override": "#visible",
              "binding_type": "collection",
              "binding_collection_name": "$bundle_collection_name"
            }
          ]
        }
      },
      {
        "content@bundle_purchase_warning.grid_item_content": {}
      },
      {
        "game_pad_focus_border@bundle_purchase_warning.focus_border_button": {}
      }
    ]
  },

  "is_focused": {
    "type": "panel",
    "controls": [
      {
        "image_border@bundle_purchase_warning.focus_border": {
          "size": [ "177.78%y - 1.5556px", "100%" ],
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "layer": 1
        }
      },
      {
        "banner_border@bundle_purchase_warning.focus_border": {
          "size": [ "100%", "100%" ],
          "layer": 2
        }
      }
    ]
  },

  "focus_border": {
    "type": "image",
    "texture": "textures/ui/square_image_border_white",
    "color": "$non_interact_border_color"
  },

  "focus_border_button@common.button": {
    "size": [ "100%", "100%" ],
    "sound_volume": 0.0,
    "$pressed_button_name": "button.focus_filler",
    "layer": 6,
    "controls": [
      { "default@common.empty_panel": {} },
      { "hover@bundle_purchase_warning.is_focused": {} },
      { "pressed@bundle_purchase_warning.is_focused": {} }
    ],
    "bindings": [
      {
        "binding_name": "#is_using_gamepad",
        "binding_name_override": "#visible"
      },
      {
        "binding_type": "collection_details",
        "binding_collection_name": "$bundle_collection_name"
      },
      {
        "binding_name": "#focus_override_up",
        "binding_type": "collection",
        "binding_collection_name": "$bundle_collection_name",
        "binding_name_override": "#focus_change_up"
      },
      {
        "binding_name": "#focus_override_down",
        "binding_type": "collection",
        "binding_collection_name": "$bundle_collection_name",
        "binding_name_override": "#focus_change_down"
      },
      {
        "binding_name": "#focus_id_override",
        "binding_type": "collection",
        "binding_collection_name": "$bundle_collection_name",
        "binding_name_override": "#focus_identifier"
      }
    ]
  },

  "grid_item_content": {
    "type": "stack_panel",
    "orientation": "horizontal",
    "size": [ "100%", "100%" ],
    "layer": 2,
    "controls": [
      {
        "image_border@common.focus_border_white": {
          "size": [ "100%c + 2px", "100%" ],
          "color": [ 0, 0, 0 ],
          "controls": [
            {
              "bundle_thumbnail": {
                "type": "image",
                "size": [ "177.78%y", "100% - 2px" ],
                "bilinear": true,
                "layer": 2,
                "bindings": [
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "$bundle_collection_name",
                    "binding_name": "#keyart_path",
                    "binding_name_override": "#texture"
                  },
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "$bundle_collection_name",
                    "binding_name": "#keyart_texture_file_system",
                    "binding_name_override": "#texture_file_system"
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "padding_0": {
          "type": "panel",
          "size": [ 2, "100%" ]
        }
      },
      {
        "bundle_title_panel": {
          "type": "panel",
          "size": [ "fill", "100%" ],
          "controls": [
            {
              "bundle_title": {
                "type": "label",
                "size": [ "100%", 10 ],
                "text": "#offer_title",
                "font_type": "smooth",
                "color": "$store_light_grey_text_color",
                "layer": 3,
                "bindings": [
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "$bundle_collection_name",
                    "binding_name": "#offer_title"
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  },

  "bundle_grid": {
    "type": "grid",
    "size": [ "100%", "default" ],
    "layer": 1,
    "anchor_to": "top_left",
    "anchor_from": "top_left",
    "grid_item_template": "bundle_purchase_warning.bundle_grid_item",
    "grid_dimension_binding": "$bundle_grid_dimension",
    "collection_name": "$bundle_collection_name",
    "bindings": [
      {
        "binding_name": "$bundle_grid_dimension"
      }
    ]
  },

  //FORWARD VARS FROM "dialog_content" TO TEMPLATE, ADD FACTORY
  "side_contents": {
    "type": "stack_panel",
    "size": [ "fill", "100%" ],
    "layer": 1,
    "controls": [
      {
        "title_alignment_hack": {
          "type": "panel",
          "size": [ "100%", 10 ],
          "controls": [
            {
              "side_section_title": {
                "type": "label",
                "text": "$label_text",
                "text_alignment": "center",
                "font_type": "smooth",
                "color": "$store_white_text_color"
              }
            }
          ]
        }
      },
      { "padding_y_0@y_padding": {} },
      {
        "grid_input_panel": {
          "type": "input_panel",
          "size": [ "100%", "fill" ],
          "focus_container": true,
          "use_last_focus": true,
          "focus_identifier": "$grid_focus_id",
          "controls": [
            {
              "grid_scroll@common.scrolling_panel": {
                "size": [ "100%", "100%" ],
                "$show_background": false,
                "$scroll_box_visible_touch": true,
                "$scrolling_content": "bundle_purchase_warning.bundle_grid",
                "$scroll_size": [ 5, "100%" ],
                "$scrolling_pane_size": [ "100%", "100%" ],
                "$scrolling_pane_offset": [ 0, 0 ],
                "$scroll_bar_right_padding_size": [ 0, 0 ]
              }
            }
          ]
        }
      }
    ]
  },

  "dialog_content": {
    "type": "stack_panel",
    "size": [ "100% - 4px", "100% - 4px" ],
    "controls": [
      {
        "grid_stack": {
          "type": "stack_panel",
          "orientation": "horizontal",
          "size": [ "100%", "100%" ],
          "controls": [
            {
              "left_grid_scroll@bundle_purchase_warning.side_contents": {
                "$label_text": "store.purchase.bundle.owned",
                "$scrolling_grid_content": "bundle_purchase_warning.scroll_contents",
                "$bundle_collection_name": "owned_list",
                "$bundle_grid_dimension": "#owned_grid_dimension",
                "$grid_focus_id": "owned_grid"
              }
            },
            {
              "padding_x_divider@bundle_purchase_warning.x_padding": {
                "size": [ 7, "100%" ]
              }
            },
            {
              "right_grid_scroll@bundle_purchase_warning.side_contents": {
                "$label_text": "store.purchase.bundle.unowned",
                "$scrolling_grid_content": "bundle_purchase_warning.scroll_contents",
                "$bundle_collection_name": "unowned_list",
                "$bundle_grid_dimension": "#unowned_grid_dimension",
                "$grid_focus_id": "unowned_grid"
              }
            }
          ]
        }
      }
    ]
  },

  "purchase_button_panel@common_buttons.light_text_button": {
    "size": [ "100% - 14px", 30 ],
    "anchor_from": "bottom_middle",
    "anchor_to": "bottom_middle",
    "$pressed_button_name": "button.confirm_bundle_purchase",
    "$button_text": "#bundle_purchase_confirm",
    "$button_text_binding_type": "global",
    "$focus_id": "purchase_button",
    "$focus_override_down": "FOCUS_OVERRIDE_STOP",
    "$focus_override_left": "FOCUS_OVERRIDE_STOP",
    "$focus_override_right": "FOCUS_OVERRIDE_STOP",
    "$focus_override_up": "owned_list_0"
  },

  // -----------------------------------------------
  //
  //    screen
  //
  // -----------------------------------------------

  "screen_dialog@common_dialogs.main_panel_one_button": {
    "$text_name": "#bundle_purchase_warning_title",
    "$child_control": "bundle_purchase_warning.dialog_content",
    "size": [ 316, "100% - 50px" ],
    "$title_text_binding_type": "global",
    "$button_panel": "bundle_purchase_warning.purchase_button_panel",
    "$show_divider": true,
    "$divider_offset": [ "50% - 1.5px", "22px" ],
    "$divider_size": [ 3, "100% - 65px" ],
    "$fill_alpha": 1
  },

  "bundle_purchase_warning_screen_content": {
    "type": "panel",
    "controls": [
      {
        "dialog@bundle_purchase_warning.screen_dialog": {
          "layer": 2
        }
      }
    ]
  },

  "background@common.screen_background": {
    "alpha": 0.65,
    "layer": 1
  },

  "bundle_purchase_warning_screen@common.base_screen": {
    "button_mappings": [
      {
        "from_button_id": "button.menu_cancel",
        "to_button_id": "button.menu_exit",
        "mapping_type": "global"
      }
    ],
    "force_render_below": true,
    "$screen_content": "bundle_purchase_warning.bundle_purchase_warning_screen_content",
    "$screen_background_control": "bundle_purchase_warning.background"
  }
}