{
  "namespace": "horse",

  "renderer_bg": {
    "type": "image",
    "texture": "textures/ui/pocket_button_pressed"
  },

  "overlay_image": {
    "type": "image",
    "alpha": 0.5
  },

  "saddle_image@horse.overlay_image": {
    "texture": "textures/ui/empty_horse_slot_saddle"
  },

  "armor_image@horse.overlay_image": {
    "texture": "textures/ui/empty_horse_slot_armor"
  },

  "carpet_image@horse.overlay_image": {
    "texture": "textures/ui/empty_llama_slot_carpet"
  },

  "horse_label@common.section_heading_label": {
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "offset": [ 7, 7 ],
    "text": "$container_title",
    "layer": 5
  },

  "equip_grid": {
    "type": "grid",
    "anchor_to": "top_left",
    "anchor_from": "top_left",
    "collection_name": "horse_equip_items",
    "grid_item_template": "@common.container_item",
    "grid_dimension_binding": "#equip_grid_dimensions",
    "$item_collection_name": "horse_equip_items",
    "bindings": [
      {
        "binding_name": "#equip_grid_dimensions"
      }
    ]
  },

  "inv_grid": {
    "type": "grid",
    "anchor_to": "top_left",
    "anchor_from": "top_left",
    "layer": 3,
    "collection_name": "container_items",
    "grid_item_template": "@common.container_item",
    "grid_dimension_binding": "#inv_grid_dimensions",
    "$item_collection_name": "container_items",
    "bindings": [
      {
        "binding_name": "#inv_grid_dimensions"
      }
    ]
  },

  "inv_bg_panel": {
    "type": "panel",
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "size": [ 90, 54 ],
    "layer": 2,
    "controls": [
      { "cell_image@common.cell_image": { } }
    ]
  },

  "equip_panel": {
    "type": "panel",
    "anchor_to": "top_left",
    "anchor_from": "top_left",
    "controls": [
      { "equip_grid@horse.equip_grid": { } },
      {
        "saddle@horse.saddle_image": {
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "size": [ 16, 16 ],
          "offset": [ 1, 1 ],
          "layer": 4,
          "bindings": [
            {
              "binding_name": "#has_saddle_slot",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "armor_0@horse.armor_image": {
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "size": [ 16, 16 ],
          "offset": [ 1, 1 ],
          "layer": 4,
          "bindings": [
            {
              "binding_name": "#has_only_armor_slot",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "carpet_0@horse.carpet_image": {
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "size": [ 16, 16 ],
          "offset": [ 1, 1 ],
          "layer": 4,
          "bindings": [
            {
              "binding_name": "#has_only_carpet_slot",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "armor_1@horse.armor_image": {
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "size": [ 16, 16 ],
          "offset": [ 1, 19 ],
          "layer": 4,
          "bindings": [
            {
              "binding_name": "#has_armor_and_saddle_slot",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "carpet_1@horse.carpet_image": {
          "anchor_from": "top_left",
          "anchor_to": "top_left",
          "size": [ 16, 16 ],
          "offset": [ 1, 19 ],
          "layer": 4,
          "bindings": [
            {
              "binding_name": "#has_carpet_and_saddle_slot",
              "binding_name_override": "#visible"
            }
          ]
        }
      }
    ]
  },

  "inv_panel": {
    "type": "panel",
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "offset": [ 79, 18 ],
    "controls": [
      { "inv_bg_panel@horse.inv_bg_panel": { } },
      { "inv_grid@horse.inv_grid": { } }
    ]
  },

  "horse_renderer": {
    "type": "panel",
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "size": [ 54, 54 ],
    "controls": [
      {
        "renderer_bg@horse.renderer_bg": {
          "layer": 3
        }
      },
      {
        "horse_custom_panel": {
          "type": "panel",
          "size": [ "30%", "30%" ],
          "offset": [ 0, "30%" ],

          "controls": [
            {
              "horse_custom": {
                "type": "custom",
                "animation_reset_name": "screen_animation_reset",
                "anims": [
                  "@common.screen_exit_size_animation_push",
                  "@common.screen_exit_size_animation_pop",
                  "@common.screen_entrance_size_animation_push",
                  "@common.screen_entrance_size_animation_pop"
                ],
                "renderer": "live_horse_renderer",
                "layer": 4,
                "anchor_from": "center",
                "anchor_to": "center",
                "bindings": [
                  {
                    "binding_name": "#entity_id"
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  },

  //---------------------------------------------------------------------------
  // Screens
  //---------------------------------------------------------------------------

  "horse_panel": {
    "type": "panel",
    "controls": [
      { "container_gamepad_helpers@common.container_gamepad_helpers": {} },
      { "flying_item_renderer@common.flying_item_renderer": {} },
      { "selected_item_details_factory@common.selected_item_details_factory": {} },
      {
        "root_panel@common.root_panel": {
          "layer": 1,
          "controls": [
            {
              "common_panel@common.common_panel": {
                "$use_compact_close_button": true
              }
            },

            { "horse_section_label@horse.horse_label": {} },
            { "inv_panel@horse.inv_panel": {} },

            {
              "equipment@horse.equip_panel": {
                "offset": [ 7, 18 ]
              }
            },
            {
              "renderer@horse.horse_renderer": {
                "offset": [ 25, 18 ]
              }
            },

            { "inventory_panel_bottom_half_with_label@common.inventory_panel_bottom_half_with_label": {} },
            { "hotbar_grid_template@common.hotbar_grid_template": {} },
            { "inventory_selected_icon_button@common.inventory_selected_icon_button": {} },
            { "gamepad_cursor@common.gamepad_cursor_button": {} }
          ]
        }
      }
    ]
  },

  "horse_screen@common.inventory_screen_common": {
    "$close_on_player_hurt|default": false,
    "close_on_player_hurt": "$close_on_player_hurt",
    "variables": [
      {
        "requires": "$desktop_screen",
        "$screen_content": "horse.horse_panel",
        "$screen_bg_content": "common.screen_background"
      },
      {
        "requires": "$pocket_screen",
        "$screen_content": "horse_pocket.horse_panel",
        "$close_on_player_hurt": true
      }
    ]
  }
}