/********************************************************
*   (c) Mojang. All rights reserved                     *
*   (c) Microsoft. All rights reserved.                 *
*********************************************************/
{
  "namespace": "chat_settings",
  /* Table of Contents
    Toggles
    Buttons
    Dropdowns
    Sliders
    Misc Elements
    Main Contents
  */

  //---------------------------------------------------------------------------
  // Toggles
  //---------------------------------------------------------------------------

  "mute_all_toggle@settings_common.option_toggle": {
    "$one_line_layout": true,
    "$option_label": "chat.settings.muteAll",

    "$option_binding_name": "#hide_chat",
    "$toggle_name": "hide_chat",
    "$focus_id": "mute_all_toggle_focus_id",
    "$focus_override_up": "reset_button_focus_id"
  },

  "chat_tts_toggle@settings_common.option_toggle": {
    "$one_line_layout": true,
    "$option_label": "chat.settings.tts",

    "$option_binding_name": "#toggle_tts",
    "$toggle_name": "toggle_tts",
    "bindings": [
      {
        "binding_name": "(not #hide_chat)",
        "binding_name_override": "#enabled"
      }
    ]
  },

  //---------------------------------------------------------------------------
  // Buttons
  //---------------------------------------------------------------------------

  "reset_button@common_buttons.light_text_button": {
    "size": [ "100%", 22 ],
    "$pressed_button_name": "button.reset_chat_settings",
    "$button_text": "options.resetSettings",

    "$focus_id": "reset_button_focus_id",
    "$focus_override_down": "mute_all_toggle_focus_id"
  },

  //---------------------------------------------------------------------------
  // Dropdowns
  //---------------------------------------------------------------------------

  // Typeface //

  "typeface_dropdown_content": {
    "type": "stack_panel",
    "size": [ "100%", "100%c" ],
    "controls": [
      {
        "top_padding@common.empty_panel": {
          "size": [ "100%", 2 ]
        }
      },
      {
        "mojangles@settings_common.radio_item_with_label_and_content": {
          "$toggle_state_binding_name": "#typeface_radio_mojangles",
          "$radio_label_text": "typeface.mojangles"
        }
      },
      {
        "noto_sans@settings_common.radio_item_with_label_and_content": {
          "$toggle_state_binding_name": "#typeface_radio_notoSans",
          "$radio_label_text": "typeface.notoSans",
          "$radio_label_font_type": "smooth"
        }
      },
      {
        "bottom_padding@common.empty_panel": {
          "size": [ "100%", 2 ]
        }
      }
    ]
  },

  "typeface_dropdown@settings_common.option_dropdown_no_scroll": {
    "$option_label": "chat.settings.font",
    "$dropdown_area": "chat_settings_content_area",
    "$dropdown_name": "chat_typeface_dropdown",
    "$option_enabled_binding_name": "#chat_typeface_dropdown_enabled",
    "$options_dropdown_toggle_label_binding": "#chat_typeface_dropdown_label",
    "bindings": [
      {
        "binding_type": "global",
        "binding_name": "#chat_typeface_visible",
        "binding_name_override": "#visible",
        "binding_condition": "once"
      }
    ],

    // Dropdown toggle button //
    "$option_dropdown_size": [ "100%", 22 ],
    "$options_dropdown_toggle_button_state_content": [ "100%", "100%" ],
    "$options_dropdown_toggle_label_font_type": "#chat_font_type",
    "$options_dropdown_toggle_label_font_scale": 1.04,
    "$options_dropdown_label_bindings": [
      {
        "binding_name": "$options_dropdown_toggle_label_binding",
        "binding_condition": "none",
        "binding_type": "$options_dropdown_toggle_label_binding_type",
        "binding_collection_name": "$options_dropdown_toggle_label_binding_collection_name"
      },
      {
        "binding_type": "global",
        "binding_name": "$options_dropdown_toggle_label_font_type",
        "binding_name_override": "#font_type",
        "binding_condition": "visible"
      }
    ],

    // Dropdown contents //
    "$dropdown_content": "chat_settings.typeface_dropdown_content"
  },

  // Font Colors //

  "chat_color_dropdown_content": {
    "type": "stack_panel",
    "size": [ "100%", "100%c" ],
    "collection_name": "font_colors",
    "controls": [
      {
        "top_padding@common.empty_panel": {
          "size": [ "100%", 2 ]
        }
      },
      {
        "0@settings_common.radio_item_with_label_and_content": {
          "collection_index": 0,
          "$toggle_state_binding_name": "('#' + $color_prefix + '_0'",
          "$focus_id": "($color_prefix + 'option_0')",
          "$focus_override_up": "($color_prefix + 'option_6')",
          "$focus_override_down": "($color_prefix + 'option_1')"
        }
      },
      {
        "1@settings_common.radio_item_with_label_and_content": {
          "collection_index": 1,
          "$toggle_state_binding_name": "('#' + $color_prefix + '_1'",
          "$focus_id": "($color_prefix + 'option_1')",
          "$focus_override_up": "($color_prefix + 'option_0')",
          "$focus_override_down": "($color_prefix + 'option_2')"
        }
      },
      {
        "2@settings_common.radio_item_with_label_and_content": {
          "collection_index": 2,
          "$toggle_state_binding_name": "('#' + $color_prefix + '_2'",
          "$focus_id": "($color_prefix + 'option_2')",
          "$focus_override_up": "($color_prefix + 'option_1')",
          "$focus_override_down": "($color_prefix + 'option_3')"
        }
      },
      {
        "3@settings_common.radio_item_with_label_and_content": {
          "collection_index": 3,
          "$toggle_state_binding_name": "('#' + $color_prefix + '_3')",
          "$focus_id": "($color_prefix + 'option_3')",
          "$focus_override_up": "($color_prefix + 'option_2')",
          "$focus_override_down": "($color_prefix + 'option_4')"
        }
      },
      {
        "4@settings_common.radio_item_with_label_and_content": {
          "collection_index": 4,
          "$toggle_state_binding_name": "('#' + $color_prefix + '_4'",
          "$focus_id": "($color_prefix + 'option_4')",
          "$focus_override_up": "($color_prefix + 'option_3')",
          "$focus_override_down": "($color_prefix + 'option_5')"
        }
      },
      {
        "5@settings_common.radio_item_with_label_and_content": {
          "collection_index": 5,
          "$toggle_state_binding_name": "('#' + $color_prefix + '_5'",
          "$focus_id": "($color_prefix + 'option_5')",
          "$focus_override_up": "($color_prefix + 'option_4')",
          "$focus_override_down": "($color_prefix + 'option_6')"
        }
      },
      {
        "6@settings_common.radio_item_with_label_and_content": {
          "collection_index": 6,
          "$toggle_state_binding_name": "('#' + $color_prefix + '_6'",
          "$focus_id": "($color_prefix + 'option_6')",
          "$focus_override_up": "($color_prefix + 'option_5')",
          "$focus_override_down": "($color_prefix + 'option_0')"
        }
      },
      {
        "bottom_padding@common.empty_panel": {
          "size": [ "100%", 2 ]
        }
      }
    ]
  },

  "colors_dropdown_base@settings_common.option_dropdown_no_scroll": {
    "$dropdown_area": "chat_settings_content_area",
    "$dropdown_name": "($color_prefix + '_color_dropdown')",
    "$option_enabled_binding_name": "('#' + $color_prefix + '_color_dropdown_enabled')",
    "$options_dropdown_toggle_label_binding": "('#' + $color_prefix + '_color_dropdown_label')",

    // Dropdown toggle button //
    "$option_dropdown_size": [ "100%", 22 ],
    "$options_dropdown_toggle_button_state_content": [ "100%", "100%" ],

    "$options_dropdown_toggle_left_padding": [ 3, "100%" ],
    "$options_dropdown_toggle_prelabel_content": "chat_settings.paintbrush",
    "$options_dropdown_toggle_prelabel_content_size": [ "100%y", "100%" ],
    "$options_dropdown_toggle_prelabel_content_padding": [ 3, "100%" ],

    // Dropdown contents //
    "$dropdown_content": "chat_settings.chat_color_dropdown_content",

    "$no_radio_content": false,
    "$radio_content_control": "chat_settings.colored_icon_panel",
    "$icon_texture": "textures/ui/text_color_paintbrush",
    "$icon_overlay_texture": "textures/ui/text_color_paintbrush_overlay",
    "$icon_color_binding": "#font_color",
    "$icon_color_binding_type": "collection",
    "$icon_color_collection_name": "font_colors",

    "$radio_label_text": "#font_color_label",
    "$radio_label_color": "#font_color",
    "$options_dropdown_toggle_label_shadow": true,
    "$radio_label_bindings": [
      {
        "binding_name": "$radio_label_text",
        "binding_collection_name": "$icon_color_collection_name",
        "binding_type": "collection"
      },
      {
        "binding_name": "$radio_label_color",
        "binding_collection_name": "$icon_color_collection_name",
        "binding_name_override": "#color",
        "binding_type": "collection"
      }
    ]
  },

  "chat_color_dropdown@chat_settings.colors_dropdown_base": {
    "$option_label": "chat.settings.chatColor",
    "$color_prefix": "chat",
    "$paintbrush_color_binding": "#chat_toggle_color"
  },

  "mentions_color_dropdown@chat_settings.colors_dropdown_base": {
    "$option_label": "chat.settings.mentionsColor",
    "$color_prefix": "mentions",
    "$paintbrush_color_binding": "#mentions_toggle_color"
  },

  //---------------------------------------------------------------------------
  // Sliders
  //---------------------------------------------------------------------------

  "font_size_slider@settings_common.option_slider": {
    "$option_label": "#chat_font_size_custom_label",
    "$slider_name": "chat_font_size",
    "$slider_value_binding_name": "#chat_font_size",
    "$option_enabled_binding_name": "#chat_font_size_enabled",
    "$slider_steps_binding_name": "#chat_font_size_steps",
    "$slider_tts_text_value": "#chat_font_size_text_value",

    "$label_bindings": [
      {
        "binding_name": "$option_label",
        "binding_condition": "visible"
      },
      {
        "binding_name": "$slider_tts_text_value"
      }
    ],
    "bindings": [
      {
        "binding_type": "global",
        "binding_name": "#chat_typeface_visible",
        "binding_name_override": "#visible",
        "binding_condition": "once"
      }
    ]
  },

  "line_spacing_slider@settings_common.option_slider": {
    "$option_label": "#chat_line_spacing_slider_label",
    "$slider_name": "chat_line_spacing",
    "$slider_value_binding_name": "#chat_line_spacing",
    "$option_enabled_binding_name": "#chat_line_spacing_enabled",
    "$slider_tts_text_value": "#chat_line_spacing_text_value",

    "$label_bindings": [
      {
        "binding_name": "$option_label",
        "binding_condition": "visible"
      },
      {
        "binding_name": "$slider_tts_text_value"
      }
    ]
  },

  //---------------------------------------------------------------------------
  // Misc Elements
  //---------------------------------------------------------------------------

  "colored_icon_panel": {
    "type": "panel",
    "size": [ "100%y", "100%" ],
    "$icon_size|default": [ "100%", "100%" ],
    "$icon_color_binding|default": "",
    "$icon_color_binding_type|default": "none",
    "$icon_color_collection_name|default": "",
    "controls": [
      {
        "icon": {
          "type": "image",
          "size": "$icon_size",
          "texture": "$icon_texture"
        }
      },
      {
        "icon_overlay": {
          "type": "image",
          "size": "$icon_size",
          "texture": "$icon_overlay_texture",
          "layer": 1,
          "bindings": [
            {
              "binding_name": "$icon_color_binding",
              "binding_name_override": "#color",
              "binding_type": "$icon_color_binding_type",
              "binding_collection_name": "$icon_color_collection_name"
            }
          ]
        }
      }
    ]
  },

  "paintbrush@chat_settings.colored_icon_panel": {
    "$icon_texture": "textures/ui/text_color_paintbrush",
    "$icon_overlay_texture": "textures/ui/text_color_paintbrush_overlay",
    "$icon_color_binding": "$paintbrush_color_binding",
    "$icon_color_binding_type": "global"
  },

  "line_break": {
    "type": "panel",
    "size": [ "100%", 7 ],
    "controls": [
      {
        "line_break_image": {
          "type": "image",
          "texture": "textures/ui/list_item_divider_line_light",
          "size": [ "100%", 1 ],
          "color": [ 0.37, 0.4, 0.41 ],
          "anchor_from": "center",
          "anchor_to": "center"
        }
      }
    ]
  },

  //---------------------------------------------------------------------------
  // Main Content
  //---------------------------------------------------------------------------

  "chat_settings_scrolling_content": {
    "type": "panel",
    "size": [ "100%", "100%c" ],
    "controls": [
      {
        // Needs to be nested so dropdowns have an area with specific name
        "chat_settings_content_area": {
          "type": "stack_panel",
          "size": [ "100%", "100%c" ],
          "controls": [
            { "mute_all_toggle@chat_settings.mute_all_toggle": {} },
            { "chat_tts_toggle@chat_settings.chat_tts_toggle": {} },


            { "toggles_to_font_shape@chat_settings.line_break": {} },

            { "typeface_dropdown@chat_settings.typeface_dropdown": {} },
            { "font_size@chat_settings.font_size_slider": {} },
            { "line_spacing@chat_settings.line_spacing_slider": {} },


            { "font_shape_to_font_colors@chat_settings.line_break": {} },

            { "chat_color@chat_settings.chat_color_dropdown": {} },
            { "mentions_color@chat_settings.mentions_color_dropdown": {} },

            { "reset_button@chat_settings.reset_button": {} }
          ]
        }
      }
    ]
  },

  "chat_setting_scrolling_panel@common.scrolling_panel": {
    "size": [ 236, 129 ],
    "clips_children": true,
    "$scroll_bar_left_padding_size": [ 3.5, 0 ],
    "$scroll_bar_right_padding_size": [ 2.5, 0 ],
    "$scrolling_content": "chat_settings.chat_settings_scrolling_content",
    "$show_background": false
  },

  "chat_settings_popup@popup_dialog.form_fit_modal_dialog_popup": {
    "$modal_title": "chat.settings",
    "$popup_dialog_escape_button_name": "button.close_chat_settings",
    "$modal_contents": "chat_settings.chat_setting_scrolling_panel",
    "$screen_background_alpha": 0.4,
    "$modal_contents_padding": [ 8, 6 ]
  },

  "popup_factory": {
    "type": "factory",
    "control_ids": {
      "chat_setting_popup": "@chat_settings.chat_settings_popup"
    }
  }
}
