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

{
  "namespace": "chest",

  ////---------------------------------------------------------------------------
  //// #slot region area
  ////---------------------------------------------------------------------------

  "chest_label": {
    "type": "label",
    "offset": [ 7, -1 ],
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "text": "$container_title",
    "size": [ "90%", "default" ],
    "color": "$title_text_color",
    "layer": 2
  },

  "chest_grid_item@common.container_item": {
    "$item_collection_name": "container_items"
  },

  "small_chest_grid": {
    "type": "grid",
    "size": [ 162, 54 ],
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "grid_dimensions": [ 9, 3 ],
    "grid_item_template": "chest.chest_grid_item",
    "collection_name": "container_items"
  },

  "large_chest_grid": {
    "type": "grid",
    "size": [ 162, 108 ],
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "grid_dimensions": [ 9, 6 ],
    "grid_item_template": "chest.chest_grid_item",
    "collection_name": "container_items"
  },

  //// #endregion

  ////---------------------------------------------------------------------------
  //// #region chest area
  ////---------------------------------------------------------------------------

  "small_chest_panel_top_half": {
    "type": "panel",
    "size": [ "100%", "50%" ],
    "offset": [ 0, 12 ],
    "anchor_to": "top_left",
    "anchor_from": "top_left",
    "controls": [
      { "chest_label@chest.chest_label": {} },
      {
        "small_chest_grid@chest.small_chest_grid": {
          "offset": [ 7, 9 ]
        }
      }
    ]
  },

  "large_chest_panel_top_half": {
    "type": "panel",
    "size": [ "100%", 132 ],
    "offset": [ 0, 11 ],
    "anchor_to": "top_left",
    "anchor_from": "top_left",
    "controls": [
      { "chest_label@chest.chest_label": {} },
      {
        "large_chest_grid@chest.large_chest_grid": {
          "offset": [ 7, 10 ]
        }
      }
    ]
  },

  //// #endregion

  ////---------------------------------------------------------------------------
  //// #region screen
  ////---------------------------------------------------------------------------

  "small_chest_panel": {
    "type": "panel",
    "controls": [
      { "container_gamepad_helpers@common.container_gamepad_helpers": {} },
      {
        "flying_item_renderer@common.flying_item_renderer": {
          "layer": 14
        }
      },
      { "selected_item_details_factory@common.selected_item_details_factory": {} },
      {
        "root_panel@common.root_panel": {
          "layer": 1,
          "controls": [
            { "common_panel@common.common_panel": {} },
            {
              "chest_panel": {
                "type": "panel",
                "layer": 5,
                "controls": [
                  { "small_chest_panel_top_half@chest.small_chest_panel_top_half": {} },
                  { "inventory_panel_bottom_half_with_label@common.inventory_panel_bottom_half_with_label": {} },
                  { "hotbar_grid@common.hotbar_grid_template": {} },
                  { "inventory_take_progress_icon_button@common.inventory_take_progress_icon_button": {} }
                ]
              }
            },
            { "inventory_selected_icon_button@common.inventory_selected_icon_button": {} },
            { "gamepad_cursor@common.gamepad_cursor_button": {} }
          ]
        }
      }
    ]
  },
  
  "selected_item_details@common.selected_item_details": {
    "offset": [ 0, 0 ]
  },

  "large_chest_panel": {
    "type": "panel",
    "controls": [
      { "container_gamepad_helpers@common.container_gamepad_helpers": {} },
      {
        "flying_item_renderer@common.flying_item_renderer": {
          "layer": 11
        }
      },
      {
        "selected_item_details_factory@common.selected_item_details_factory": {
          "control_name": "@chest.selected_item_details"
        }
      },
      {
        "root_panel@common.root_panel": {
          "size": [ 176, 220 ],
          "layer": 1,
          "controls": [
            { "common_panel@common.common_panel": {} },
            {
              "chest_panel": {
                "type": "panel",
                "layer": 5,
                "controls": [
                  { "large_chest_panel_top_half@chest.large_chest_panel_top_half": {} },
                  { "inventory_panel_bottom_half_with_label@common.inventory_panel_bottom_half_with_label": {} },
                  { "hotbar_grid@common.hotbar_grid_template": {} },
                  { "inventory_take_progress_icon_button@common.inventory_take_progress_icon_button": {} }
                ]
              }
            },
            { "inventory_selected_icon_button@common.inventory_selected_icon_button": {} },
            { "gamepad_cursor@common.gamepad_cursor_button": {} }
          ]
        }
      }
    ]
  },

  "ender_chest_panel@chest.small_chest_panel": {
  },

  "shulker_box_panel@chest.small_chest_panel": {
  },

  "barrel_panel@chest.small_chest_panel": {
  },

  "small_chest_screen@common.inventory_screen_common": {
    "$close_on_player_hurt|default": true,
    "close_on_player_hurt": "$close_on_player_hurt",
    "variables": [
      {
        "requires": "$desktop_screen",
        "$screen_content": "chest.small_chest_panel",
        "$screen_bg_content": "common.screen_background"
      },
      {
        "requires": "$pocket_screen",
        "$screen_content": "pocket_containers.small_chest_panel"
      }
    ]
  },

  "large_chest_screen@common.inventory_screen_common": {
    "$close_on_player_hurt|default": true,
    "close_on_player_hurt": "$close_on_player_hurt",
    "variables": [
      {
        "requires": "$desktop_screen",
        "$screen_content": "chest.large_chest_panel",
        "$screen_bg_content": "common.screen_background"
      },
      {
        "requires": "$pocket_screen",
        "$screen_content": "pocket_containers.large_chest_panel"
      }
    ]
  },

  "ender_chest_screen@common.inventory_screen_common": {
    "$close_on_player_hurt|default": true,
    "close_on_player_hurt": "$close_on_player_hurt",
    "variables": [
      {
        "requires": "$desktop_screen",
        "$screen_content": "chest.ender_chest_panel",
        "$screen_bg_content": "common.screen_background"
      },
      {
        "requires": "$pocket_screen",
        "$screen_content": "pocket_containers.ender_chest_panel"
      }
    ]
  },

  "shulker_box_screen@chest.small_chest_screen": {
    "$close_on_player_hurt": true,
    "variables": [
      {
        "requires": "$desktop_screen",
        "$screen_content": "chest.shulker_box_panel",
        "$screen_bg_content": "common.screen_background"
      },
      {
        "requires": "$pocket_screen",
        "$screen_content": "pocket_containers.shulker_box_panel"
      }
    ]
  },

  "barrel_screen@chest.small_chest_screen": {
    "$close_on_player_hurt": true,
    "variables": [
      {
        "requires": "$desktop_screen",
        "$screen_content": "chest.barrel_panel",
        "$screen_bg_content": "common.screen_background"
      },
      {
        "requires": "$pocket_screen",
        "$screen_content": "pocket_containers.barrel_panel"
      }
    ]
  }
}

// #endregion