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

{
  "namespace": "labtable",

  ///// Shared with Pocket Screen /////

  "jar_animation": {
    "anim_type": "flip_book",
    "initial_uv": [ 0, 0 ],
    "frame_count": 29,
    "frame_step": 45,
    "fps": 10,
    "easing": "linear"
  },

  "beaker_animation": {
    "anim_type": "flip_book",
    "initial_uv": [ 0, 0 ],
    "frame_count": 17,
    "frame_step": 45,
    "fps": 10,
    "easing": "linear"
  },

  "flask_animation": {
    "anim_type": "flip_book",
    "initial_uv": [ 0, 0 ],
    "frame_count": 21,
    "frame_step": 45,
    "fps": 10,
    "easing": "linear"
  },

  "tool@common.empty_panel": {
    "size": [ "100%c + 5px", "100%c" ],
    "$image_offset|default": [ 0, 0 ],
    "controls": [
      {
        "active": {
          "type": "image",
          "texture": "$active_texture",
          "size": "$image_size",
          "offset": "$image_offset",
          "uv": "$active_animation",
          "uv_size": [ 45, 45 ],
          "bindings": [
            {
              "binding_name": "$active_binding",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "default": {
          "type": "image",
          "texture": "$default_texture",
          "size": "$image_size",
          "offset": "$image_offset",
          "bindings": [
            {
              "binding_name": "(not $active_binding)",
              "binding_name_override": "#visible"
            }
          ]
        }
      }
    ]
  },

  ///// Differs from Pocket Screen /////

  "title_label@edu_common.dark_label": {
    "layer": 2,
    "text": "labtable.title",
    "size": [ "100%", "default" ],
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "text_alignment": "center",
    "offset": [ 0, 4 ]
  },

  "input_slot@common.container_item": {
    "$item_collection_name": "labtable_input"
  },

  "input_grid": {
    "type": "grid",
    "size": [ "100%", 18 ],
    "grid_dimensions": [ 9, 1 ],
    "grid_item_template": "labtable.input_slot",
    "collection_name": "labtable_input"
  },

  "tools_panel": {
    "type": "stack_panel",
    "orientation": "horizontal",
    "size": [ "100%c", 50 ],
    "controls": [
      {
        "beaker@labtable.tool": {
          "$image_size": [ 45, 45 ],
          "$active_texture": "textures/ui/beaker_active",
          "$default_texture": "textures/ui/beaker_default",
          "$active_animation": "@labtable.beaker_animation",
          "$active_binding": "#beaker_active"
        }
      },
      {
        "flask@labtable.tool": {
          "$image_size": [ 45, 45 ],
          "$active_texture": "textures/ui/flask_active",
          "$active_animation": "@labtable.flask_animation",
          "$default_texture": "textures/ui/flask_default",
          "$active_binding": "#flask_active"
        }
      },
      {
        "jar@labtable.tool": {
          "$image_size": [ 45, 45 ],
          "$image_offset": [ 5, 0 ],
          "$active_texture": "textures/ui/jar_active",
          "$active_animation": "@labtable.jar_animation",
          "$default_texture": "textures/ui/jar_default",
          "$active_binding": "#jar_active"
        }
      }
    ]
  },

  "combine_button@common.empty_panel": {
    "size": [ "100%", 20 ],
    "controls": [
      {
        "button@common_buttons.light_text_button": {
          "size": [ 100, 14 ],
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle",
          "$button_text": "labtable.combine",
          "$pressed_button_name": "button.combine"
        }
      }
    ],
    "bindings": [
      {
        "binding_name": "#combine_enabled",
        "binding_name_override": "#enabled"
      }
    ]
  },

  "top_half": {
    "type": "stack_panel",
    "orientation": "vertical",
    // Offset so it starts under the title label and within the frame, and goes down to the inventory
    "offset": [ 4, 14 ],
    "size": [ "100% - 8px", 95 ],
    "layer": 2,
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "controls": [
      { "tools@labtable.tools_panel": {} },
      { "pa@common.empty_panel": { "size": [ 1, 4 ] } },
      { "input@labtable.input_grid": {} },
      { "combine@labtable.combine_button": {} }
    ]
  },

  "content": {
    "type": "panel",
    "controls": [
      {
        "root_panel@common.root_panel": {
          "layer": 1,
          "size": [ 176, 200 ],
          "controls": [
            { "common_panel@common.common_panel": {} },
            { "title_label@labtable.title_label": {} },
            { "top_half@labtable.top_half": {} },
            {
              "inventory": {
                "type": "panel",
                "layer": 3,
                "controls": [
                  { "inventory_panel_bottom_half@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": {} }
          ]
        }
      },
      { "container_gamepad_helpers@common.container_gamepad_helpers": {} } // Gamepad tool tips
    ]
  },

  "lab_table@common.inventory_screen_common": {
    "$close_on_player_hurt|default": false,
    "close_on_player_hurt": "$close_on_player_hurt",
    "$screen_bg_content": "common.screen_background",

    "variables": [
      {
        "requires": "$desktop_screen",
        "$screen_content": "labtable.content"
      },
      {
        "requires": "$pocket_screen",
        "$screen_content": "labtable_pocket.content"
      }
    ]
  }
}