{
  "$schema": "http://json-schema.org/draft-07/schema",
  "title": "Minecraft JSON UI",
  "type": "object",
  "properties": {
    "namespace": {
      "title": "Namespace",
      "type": "string",
      "pattern": "^[a-zA-Z0-9_-]+$"
    }
  },
  "definitions": {
    "animation": {
      "type": "object",
      "title": "Animation",
      "description": "An animation is a set of keyframes that can be applied to an element.",
      "additionalProperties": false,
      "required": ["anim_type"],
      "patternProperties": {
        "^\\$.*": {
          "$ref": "./general/variables.json"
        }
      },
      "properties": {
        "anim_type": { "$ref": "./elements/properties/anim_type.json" },
        "animation_reset_name": { "$ref": "./elements/properties/animation_reset_name.json" },
        "destroy_at_end": { "$ref": "./elements/properties/destroy_at_end.json" },
        "disable_anim_fast_forward": { "$ref": "./elements/properties/disable_anim_fast_forward.json" },
        "duration": { "$ref": "./elements/properties/duration.json" },
        "easing": { "$ref": "./elements/properties/easing.json" },
        "end_event": { "$ref": "./elements/properties/end_event.json" },
        "fps": { "$ref": "./elements/properties/fps.json" },
        "frame_count": { "$ref": "./elements/properties/frame_count.json" },
        "frame_step": { "$ref": "./elements/properties/frame_step.json" },
        "from": { "$ref": "./elements/properties/from.json" },
        "initial_uv": { "$ref": "./elements/properties/initial_uv.json" },
        "next": { "$ref": "./elements/properties/next.json" },
        "play_event": { "$ref": "./elements/properties/play_event.json" },
        "propagate_alpha": { "$ref": "./elements/properties/propagate_alpha.json" },
        "reversible": { "$ref": "./elements/properties/reversible.json" },
        "scale_from_starting_alpha": { "$ref": "./elements/properties/scale_from_starting_alpha.json" },
        "to": { "$ref": "./elements/properties/to.json" },
        "uv": { "$ref": "./elements/properties/uv.json" },
        "uv_size": { "$ref": "./elements/properties/uv_size.json" }
      }
    },
    "control": {
      "title": "Element",
      "description": "An element is a control that can be added to a screen. It can be a button, a label, an image, etc.",
      "type": "object",
      "propertyNames": {
        "examples": ["$variable"]
      },
      "additionalProperties": false,
      "patternProperties": {
        "^\\$.*": {
          "$ref": "./general/variables.json"
        }
      },
      "properties": {
        "controls": {
          "title": "Controls",
          "description": "The controls that are contained within this element.",
          "anyOf": [
            {
              "type": "array",
              "items": {
                "additionalProperties": {
                  "title": "Sub Element",
                  "$ref": "#/definitions/grouped-ui"
                }
              }
            },
            {
              "$ref": "./general/item_ref.json"
            }
          ]
        },
        "modifications": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "title": "Modifications",
          "description": "Modifications to the element.",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "control_name": {
                "title": "Control Name",
                "type": "string"
              },
              "array_name": {
                "title": "Array Name",
                "type": "string",
                "enum": ["bindings", "controls"]
              },
              "operation": {
                "title": "Operation",
                "type": "string",
                "enum": ["insert_back", "insert_front", "insert_after", "insert_before", "move_back", "move_front", "move_after", "move_before", "swap", "remove", "replace"]
              },
              "where": { "$ref": "./elements/properties/bindings.json" },
              "target": { "$ref": "./elements/properties/bindings.json" },
              "target_control": {
                "type": "string"
              },
              "value": {
                "oneOf": [
                  { "$ref": "./elements/properties/bindings.json" },
                  {
                    "title": "Controls",
                    "description": "The controls to add.",
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "additionalProperties": {
                            "title": "Sub Element",
                            "$ref": "#/definitions/grouped-ui"
                          }
                        }
                      },
                      {
                        "$ref": "./general/item_ref.json"
                      }
                    ]
                  }
                ]
              }
            }
          }
        },

        "allow_clipping": { "$ref": "./elements/properties/allow_clipping.json" },
        "allow_debug_missing_texture": { "$ref": "./elements/properties/allow_debug_missing_texture.json" },
        "allow_scroll_even_when_content_fits": { "$ref": "./elements/properties/allow_scroll_even_when_content_fits.json" },
        "alpha": { "$ref": "./elements/properties/alpha.json" },
        "always_handle_pointer": { "$ref": "./elements/properties/always_handle_pointer.json" },
        "always_handle_scrolling": { "$ref": "./elements/properties/always_handle_scrolling.json" },
        "always_listen_to_input": { "$ref": "./elements/properties/always_listen_to_input.json" },
        "always_rotate": { "$ref": "./elements/properties/always_rotate.json" },
        "anchor_from": { "$ref": "./elements/properties/anchor_from.json" },
        "anchor_to": { "$ref": "./elements/properties/anchor_to.json" },
        "anims": { "$ref": "./elements/properties/anims.json" },
        "background_control": { "$ref": "./elements/properties/background_control.json" },
        "background_hover_control": { "$ref": "./elements/properties/background_hover_control.json" },
        "backup_font_type": { "$ref": "./elements/properties/backup_font_type.json" },
        "bilinear": { "$ref": "./elements/properties/bilinear.json" },
        "bindings": { "$ref": "./elements/properties/bindings.json" },
        "button_mappings": { "$ref": "./elements/properties/button_mappings.json" },
        "cache_screen": { "$ref": "./elements/properties/cache_screen.json" },
        "checked_control": { "$ref": "./elements/properties/checked_control.json" },
        "checked_hover_control": { "$ref": "./elements/properties/checked_hover_control.json" },
        "checked_locked_control": { "$ref": "./elements/properties/checked_locked_control.json" },
        "checked_locked_hover_control": { "$ref": "./elements/properties/checked_locked_hover_control.json" },
        "clip_direction": { "$ref": "./elements/properties/clip_direction.json" },
        "clip_pixelperfect": { "$ref": "./elements/properties/clip_pixelperfect.json" },
        "clips_children": { "$ref": "./elements/properties/clips_children.json" },
        "close_on_player_hurt": { "$ref": "./elements/properties/close_on_player_hurt.json" },
        "collection_index": { "$ref": "./elements/properties/collection_index.json" },
        "collection_name": { "$ref": "./elements/properties/collection_name.json" },
        "color": { "$ref": "./elements/properties/color.json" },
        "consume_hover_events": { "$ref": "./elements/properties/consume_hover_events.json" },
        "contained": { "$ref": "./elements/properties/contained.json" },
        "control_name": { "$ref": "./elements/properties/control_name.json" },
        "default_control": { "$ref": "./elements/properties/default_control.json" },
        "default_focus_precedence": { "$ref": "./elements/properties/default_focus_precedence.json" },
        "disable_anim_fast_forward": { "$ref": "./elements/properties/disable_anim_fast_forward.json" },
        "draggable": { "$ref": "./elements/properties/draggable.json" },
        "dropdown_area": { "$ref": "./elements/properties/dropdown_area.json" },
        "dropdown_content_control": { "$ref": "./elements/properties/dropdown_content_control.json" },
        "dropdown_name": { "$ref": "./elements/properties/dropdown_name.json" },
        "enable_directional_toggling": { "$ref": "./elements/properties/enable_directional_toggling.json" },
        "enable_profanity_filter": { "$ref": "./elements/properties/enable_profanity_filter.json" },
        "enabled_newline": { "$ref": "./elements/properties/enabled_newline.json" },
        "enabled": { "$ref": "./elements/properties/enabled.json" },
        "factory": { "$ref": "./elements/properties/factory.json" },
        "fill": { "$ref": "./elements/properties/fill.json" },
        "focus_change_down": { "$ref": "./elements/properties/focus_change_down.json" },
        "focus_change_left": { "$ref": "./elements/properties/focus_change_left.json" },
        "focus_change_right": { "$ref": "./elements/properties/focus_change_right.json" },
        "focus_change_up": { "$ref": "./elements/properties/focus_change_up.json" },
        "focus_container": { "$ref": "./elements/properties/focus_container.json" },
        "focus_enabled": { "$ref": "./elements/properties/focus_enabled.json" },
        "focus_identifier": { "$ref": "./elements/properties/focus_identifier.json" },
        "focus_magnet_enabled": { "$ref": "./elements/properties/focus_magnet_enabled.json" },
        "focus_navigation_mode_down": { "$ref": "./elements/properties/focus_navigation_mode_down.json" },
        "focus_navigation_mode_left": { "$ref": "./elements/properties/focus_navigation_mode_left.json" },
        "focus_navigation_mode_right": { "$ref": "./elements/properties/focus_navigation_mode_right.json" },
        "focus_navigation_mode_up": { "$ref": "./elements/properties/focus_navigation_mode_up.json" },
        "focus_wrap_enabled": { "$ref": "./elements/properties/focus_wrap_enabled.json" },
        "font_scale_factor": { "$ref": "./elements/properties/font_scale_factor.json" },
        "font_size": { "$ref": "./elements/properties/font_size.json" },
        "font_type": { "$ref": "./elements/properties/font_type.json" },
        "force_render_below": { "$ref": "./elements/properties/force_render_below.json" },
        "force_texture_reload": { "$ref": "./elements/properties/force_texture_reload.json" },
        "grid_dimension_binding": { "$ref": "./elements/properties/grid_dimension_binding.json" },
        "grid_dimensions": { "$ref": "./elements/properties/grid_dimensions.json" },
        "grid_item_template": { "$ref": "./elements/properties/grid_item_template.json" },
        "grid_position": { "$ref": "./elements/properties/grid_position.json" },
        "grid_rescaling_type": { "$ref": "./elements/properties/grid_rescaling_type.json" },
        "handle_deselect": { "$ref": "./elements/properties/handle_deselect.json" },
        "handle_select": { "$ref": "./elements/properties/handle_select.json" },
        "hide_hyphen": { "$ref": "./elements/properties/hide_hyphen.json" },
        "hover_alpha": { "$ref": "./elements/properties/alpha.json" },
        "hover_color": { "$ref": "./elements/properties/color.json" },
        "hover_control": { "$ref": "./elements/properties/hover_control.json" },
        "hover_enabled": { "$ref": "./elements/properties/hover_enabled.json" },
        "ignored": { "$ref": "./elements/properties/ignored.json" },
        "images": { "$ref": "./elements/properties/images.json" },
        "indent_control": { "$ref": "./elements/properties/indent_control.json" },
        "inherit_max_sibling_height": { "$ref": "./elements/properties/inherit_max_sibling_height.json" },
        "inherit_max_sibling_width": { "$ref": "./elements/properties/inherit_max_sibling_width.json" },
        "is_modal": { "$ref": "./elements/properties/is_modal.json" },
        "is_showing_menu": { "$ref": "./elements/properties/is_showing_menu.json" },
        "jump_to_bottom_on_update": { "$ref": "./elements/properties/jump_to_bottom_on_update.json" },
        "keep_ratio": { "$ref": "./elements/properties/keep_ratio.json" },
        "layer": { "$ref": "./elements/properties/layer.json" },
        "localize": { "$ref": "./elements/properties/localize.json" },
        "locked_alpha": { "$ref": "./elements/properties/alpha.json" },
        "locked_color": { "$ref": "./elements/properties/color.json" },
        "locked_control": { "$ref": "./elements/properties/locked_control.json" },
        "low_frequency_rendering": { "$ref": "./elements/properties/low_frequency_rendering.json" },
        "max_length": { "$ref": "./elements/properties/max_length.json" },
        "max_size": { "$ref": "./elements/properties/max_size.json" },
        "maximum_grid_items": { "$ref": "./elements/properties/maximum_grid_items.json" },
        "min_size": { "$ref": "./elements/properties/min_size.json" },
        "modal": { "$ref": "./elements/properties/modal.json" },
        "offset": { "$ref": "./elements/properties/offset.json" },
        "orientation": { "$ref": "./elements/properties/orientation.json" },
        "place_holder_control": { "$ref": "./elements/properties/place_holder_control.json" },
        "pressed_alpha": { "$ref": "./elements/properties/alpha.json" },
        "pressed_color": { "$ref": "./elements/properties/color.json" },
        "pressed_control": { "$ref": "./elements/properties/pressed_control.json" },
        "prevent_touch_input": { "$ref": "./elements/properties/prevent_touch_input.json" },
        "primary_color": { "$ref": "./elements/properties/color.json" },
        "progress_control": { "$ref": "./elements/properties/progress_control.json" },
        "progress_hover_control": { "$ref": "./elements/properties/progress_hover_control.json" },
        "propagate_alpha": { "$ref": "./elements/properties/propagate_alpha.json" },
        "property_bag": { "$ref": "./elements/properties/property_bag.json" },
        "radio_toggle_group": { "$ref": "./elements/properties/radio_toggle_group.json" },
        "render_game_behind": { "$ref": "./elements/properties/render_game_behind.json" },
        "render_only_when_topmost": { "$ref": "./elements/properties/render_only_when_topmost.json" },
        "renderer": { "$ref": "./elements/properties/renderer.json" },
        "reset_event": { "$ref": "./elements/properties/reset_event.json" },
        "reset_on_focus_lost": { "$ref": "./elements/properties/reset_on_focus_lost.json" },
        "rotate_speed": { "$ref": "./elements/properties/rotate_speed.json" },
        "screen_draws_last": { "$ref": "./elements/properties/screen_draws_last.json" },
        "screen_not_flushable": { "$ref": "./elements/properties/screen_not_flushable.json" },
        "scroll_box_and_track_panel": { "$ref": "./elements/properties/scroll_box_and_track_panel.json" },
        "scroll_content": { "$ref": "./elements/properties/scroll_content.json" },
        "scroll_speed": { "$ref": "./elements/properties/scroll_speed.json" },
        "scroll_view_port": { "$ref": "./elements/properties/scroll_view_port.json" },
        "scrollbar_box": { "$ref": "./elements/properties/scrollbar_box.json" },
        "scrollbar_touch_button": { "$ref": "./elements/properties/scrollbar_touch_button.json" },
        "scrollbar_track_button": { "$ref": "./elements/properties/scrollbar_track_button.json" },
        "scrollbar_track": { "$ref": "./elements/properties/scrollbar_track.json" },
        "send_telemetry": { "$ref": "./elements/properties/send_telemetry.json" },
        "shadow": { "$ref": "./elements/properties/shadow.json" },
        "should_steal_mouse": { "$ref": "./elements/properties/should_steal_mouse.json" },
        "size": { "$ref": "./elements/properties/size.json" },
        "slider_box_control": { "$ref": "./elements/properties/slider_box_control.json" },
        "slider_collection_name": { "$ref": "./elements/properties/slider_collection_name.json" },
        "slider_deselected_button": { "$ref": "./elements/properties/slider_deselected_button.json" },
        "slider_direction": { "$ref": "./elements/properties/slider_direction.json" },
        "slider_name": { "$ref": "./elements/properties/slider_name.json" },
        "slider_select_on_hover": { "$ref": "./elements/properties/slider_select_on_hover.json" },
        "slider_selected_button": { "$ref": "./elements/properties/slider_selected_button.json" },
        "slider_small_decrease_button": { "$ref": "./elements/properties/slider_small_decrease_button.json" },
        "slider_small_increase_button": { "$ref": "./elements/properties/slider_small_increase_button.json" },
        "slider_steps": { "$ref": "./elements/properties/slider_steps.json" },
        "slider_track_button": { "$ref": "./elements/properties/slider_track_button.json" },
        "sound_name": { "$ref": "./elements/properties/sound_name.json" },
        "sound_pitch": { "$ref": "./elements/properties/sound_pitch.json" },
        "sound_volume": { "$ref": "./elements/properties/sound_volume.json" },
        "text_alignment": { "$ref": "./elements/properties/text_alignment.json" },
        "text_box_name": { "$ref": "./elements/properties/text_box_name.json" },
        "text_control": { "$ref": "./elements/properties/text_control.json" },
        "text_edit_box_grid_collection_name": { "$ref": "./elements/properties/text_edit_box_grid_collection_name.json" },
        "text_labels": { "$ref": "./elements/properties/text_labels.json" },
        "text_type": { "$ref": "./elements/properties/text_type.json" },
        "text": { "$ref": "./elements/properties/text.json" },
        "texture_file_system": { "$ref": "./elements/properties/texture_file_system.json" },
        "texture": { "$ref": "./elements/properties/texture.json" },
        "tiled": { "$ref": "./elements/properties/tiled.json" },
        "toggle_default_state": { "$ref": "./elements/properties/toggle_default_state.json" },
        "toggle_grid_collection_name": { "$ref": "./elements/properties/toggle_grid_collection_name.json" },
        "toggle_group_default_selected": { "$ref": "./elements/properties/toggle_group_default_selected.json" },
        "toggle_group_forced_index": { "$ref": "./elements/properties/toggle_group_forced_index.json" },
        "toggle_name": { "$ref": "./elements/properties/toggle_name.json" },
        "toggle_off_button": { "$ref": "./elements/properties/toggle_off_button.json" },
        "toggle_on_button": { "$ref": "./elements/properties/toggle_on_button.json" },
        "touch_mode": { "$ref": "./elements/properties/touch_mode.json" },
        "tts_control_header": { "$ref": "./elements/properties/tts/control_header.json" },
        "tts_control_type_order_priority": { "$ref": "./elements/properties/tts/control_type_order_priority.json" },
        "tts_ignore_count": { "$ref": "./elements/properties/tts/ignore_count.json" },
        "tts_ignore_subsections": { "$ref": "./elements/properties/tts/ignore_subsections.json" },
        "tts_index_priority": { "$ref": "./elements/properties/tts/index_priority.json" },
        "tts_inherit_siblings": { "$ref": "./elements/properties/tts/inherit_siblings.json" },
        "tts_name": { "$ref": "./elements/properties/tts/name.json" },
        "tts_override_control_value": { "$ref": "./elements/properties/tts/override_control_value.json" },
        "tts_section_header": { "$ref": "./elements/properties/tts/section_header.json" },
        "tts_toggle_off": { "$ref": "./elements/properties/tts/toggle_off.json" },
        "tts_toggle_on": { "$ref": "./elements/properties/tts/toggle_on.json" },
        "tts_value_changed": { "$ref": "./elements/properties/tts/value_changed.json" },
        "tts_value_order_priority": { "$ref": "./elements/properties/tts/value_order_priority.json" },
        "ttsSectionContainer": { "$ref": "./elements/properties/ttsSectionContainer.json" },
        "type": { "$ref": "./elements/properties/type.json" },
        "unchecked_control": { "$ref": "./elements/properties/unchecked_control.json" },
        "unchecked_hover_control": { "$ref": "./elements/properties/unchecked_hover_control.json" },
        "unchecked_locked_control": { "$ref": "./elements/properties/unchecked_locked_control.json" },
        "unchecked_locked_hover_control": { "$ref": "./elements/properties/unchecked_locked_hover_control.json" },
        "use_anchored_offset": { "$ref": "./elements/properties/use_anchored_offset.json" },
        "use_child_anchors": { "$ref": "./elements/properties/use_child_anchors.json" },
        "use_last_focus": { "$ref": "./elements/properties/use_last_focus.json" },
        "uv_size": { "$ref": "./elements/properties/uv_size.json" },
        "uv": { "$ref": "./elements/properties/uv.json" },
        "variables": { "$ref": "./elements/properties/variables.json" },
        "virtual_keyboard_buffer_control": { "$ref": "./elements/properties/virtual_keyboard_buffer_control.json" },
        "visible": { "$ref": "./elements/properties/visible.json" },
        "zip_folder": { "$ref": "./elements/properties/zip_folder.json" }
      }
    },
    "control_factory": {
      "title": "Control Factory",
      "type": "object",
      "propertyNames": {
        "examples": ["$variable"]
      },
      "additionalProperties": false,
      "patternProperties": {
        "^\\$.*": {
          "$ref": "./general/variables.json"
        }
      },
      "properties": {
        "type": {
          "title": "Type",
          "description": "The type of the element",
          "type": "string",
          "enum": ["factory"]
        },
        "control_ids": { "$ref": "./elements/properties/control_ids.json" },
        "control_name": { "$ref": "./elements/properties/control_name.json" }
      }
    },
    "grouped-ui": {
      "$schema": "http://json-schema.org/draft-07/schema",
      "title": "UI Definition",
      "type": "object",
      "anyOf": [{ "$ref": "#/definitions/control" }, { "$ref": "#/definitions/animation" }, { "$ref": "#/definitions/control_factory" }]
    }
  },
  "additionalProperties": {
    "$ref": "#/definitions/grouped-ui"
  }
}
