{
  "namespace": "safe_zone",


  //---------------------------------------------------------------------------
  // Common
  //---------------------------------------------------------------------------

  "corner_image_common": {
    "type": "image",
    "size": [ 19, 19 ],
    "layer": 1,
    "use_anchored_offset": true,
    "property_bag": {
      "#anchored_offset_value_x": 0.0,
      "#anchored_offset_value_y": 0.0
    },
    "bindings": [
      {
        "binding_name": "$local_safe_zone_offset_x",
        "binding_name_override": "#anchored_offset_value_x"
      },
      {
        "binding_name": "$local_safe_zone_offset_y",
        "binding_name_override": "#anchored_offset_value_y"
      }
    ]
  },

  "corner_bl@safe_zone.corner_image_common": {
    "texture": "textures/ui/photo_corner_bl",
    "anchor_to": "bottom_left",
    "anchor_from": "bottom_left",
    "$local_safe_zone_offset_x": "#left_safe_zone_offset",
    "$local_safe_zone_offset_y": "#bottom_safe_zone_offset"
  },

  "corner_br@safe_zone.corner_image_common": {
    "texture": "textures/ui/photo_corner_br",
    "anchor_to": "bottom_right",
    "anchor_from": "bottom_right",
    "$local_safe_zone_offset_x": "#right_safe_zone_offset",
    "$local_safe_zone_offset_y": "#bottom_safe_zone_offset"
  },

  "corner_tr@safe_zone.corner_image_common": {
    "texture": "textures/ui/photo_corner_tr",
    "anchor_to": "top_right",
    "anchor_from": "top_right",
    "$local_safe_zone_offset_x": "#right_safe_zone_offset",
    "$local_safe_zone_offset_y": "#top_safe_zone_offset"
  },

  "corner_tl@safe_zone.corner_image_common": {
    "texture": "textures/ui/photo_corner_tl",
    "anchor_to": "top_left",
    "anchor_from": "top_left",
    "$local_safe_zone_offset_x": "#left_safe_zone_offset",
    "$local_safe_zone_offset_y": "#top_safe_zone_offset"
  },

  "confirm_button@common_buttons.light_text_button": {
    "layer": 1,
    "size": [ "100% - 14px", 30 ],
    "$pressed_button_name": "button.confirm_button",
    "$button_text": "gui.confirm"
  },

  "title_text": {
    "type": "label",
    "layer": 1,
    "text": "options.safeZone.title",
    "color": "$title_text_color"
  },

  "instructions_text": {
    "type": "label",
    "layer": 1,
    "size": [ "100%", "default" ],
    "text": "options.safeZone.description",
    "color": "$body_text_color"
  },

  "label_button@common.button": {
    "sound_volume": 1.0,
    "size": [ "100%", "100%c" ],
    "$pressed_button_name": "button.focus_filler",
    "$button_tts_name": "",
    "focus_enabled": true
  },

  "label_button_hover": {
    "type": "panel",
    "size": [ "100%", "100%c" ],
    "controls": [
      {
        "hover@common.focus_border_white": {
          "size": [ "100%", "100%c" ],
          "controls": [
            {
              "button_hover_text@safe_zone.instructions_text": {}
            }
          ]
        }
      }
    ]
  },

  "content_panel": {
    "type": "stack_panel",
    "ttsSectionContainer": true,
    "$label_bindings": [
      {
        "binding_name": "$option_label"
      },
      {
        "binding_name": "$slider_tts_text_value"
      }
    ],
    "controls": [
      {
        "safe_zone_slider_all@settings_common.option_slider": {
          "$option_label": "#safe_zone_all_slider_label",
          "$slider_name": "safe_zone_all",
          "$slider_value_binding_name": "#safe_zone_all",
          "$option_enabled_binding_name": "#safe_zone_all_enabled",
          "$default_focus_precedence": 1,
          "$slider_select_on_hover": false,
          "$slider_tts_text_value": "#safe_zone_all_text_value"
        }
      },
      {
        "safe_zone_slider_x@settings_common.option_slider": {
          "ignored": "$is_publish",
          "$option_label": "#safe_zone_x_slider_label",
          "$slider_name": "safe_zone_x",
          "$slider_value_binding_name": "#safe_zone_x",
          "$option_enabled_binding_name": "#safe_zone_x_enabled",
          "$slider_select_on_hover": false,
          "$slider_tts_text_value": "#safe_zone_x_text_value"
        }
      },
      {
        "safe_zone_slider_y@settings_common.option_slider": {
          "ignored": "$is_publish",
          "$option_label": "#safe_zone_y_slider_label",
          "$slider_name": "safe_zone_y",
          "$slider_value_binding_name": "#safe_zone_y",
          "$option_enabled_binding_name": "#safe_zone_y_enabled",
          "$slider_select_on_hover": false,
          "$slider_tts_text_value": "#safe_zone_y_text_value"
        }
      },
      {
        "screen_position_slider_x@settings_common.option_slider": {
          "ignored": "$is_publish",
          "$option_label": "#screen_position_x_slider_label",
          "$slider_name": "screen_position_x",
          "$slider_value_binding_name": "#screen_position_x",
          "$option_enabled_binding_name": "#screen_position_x_enabled",
          "$slider_select_on_hover": false,
          "$slider_tts_text_value": "#screen_position_x_text_value"
        }
      },
      {
        "screen_position_slider_y@settings_common.option_slider": {
          "ignored": "$is_publish",
          "$option_label": "#screen_position_y_slider_label",
          "$slider_name": "screen_position_y",
          "$slider_value_binding_name": "#screen_position_y",
          "$option_enabled_binding_name": "#screen_position_y_enabled",
          "$slider_select_on_hover": false,
          "$slider_tts_text_value": "#screen_position_y_text_value"
        }
      },
      {
        "instruction_text_button@safe_zone.label_button": {
          "offset": [ 0, 3 ],
          "controls": [
            {
              "default@safe_zone.instructions_text": {}
            },
            {
              "pressed@safe_zone.label_button_hover": {}
            },
            {
              "hover@safe_zone.label_button_hover": {}
            }
          ]
        }
      }
    ]
  },

  // Screen //

  "safe_zone_screen@common.base_screen": {
    "should_be_skipped_during_automation": true,
    "variables": [
      {
        "requires": "$is_publish",
        "$dialog_size": [ 192, 140 ]
      },
      {
        "requires": "(not $is_publish)",
        "$dialog_size": [ 192, 206 ]
      }
    ],
    "controls": [
      {
        "safe_zone_bounds_markers": {
          "type": "panel",
          "controls": [
            { "top_left_marker@corner_tl": {} },
            { "top_right_marker@corner_tr": {} },
            { "bottom_left_marker@corner_bl": {} },
            { "bottom_right_marker@corner_br": {} }
          ]
        }
      },
      {
        "main_content_panel": {
          "type": "panel",
          "size": "$dialog_size",
          "ttsSectionContainer": true,
          "controls": [
            {
              "common_panel@common.common_panel": {
                "$show_close_button": false,
                "$dialog_background": "dialog_background_hollow_2"
              }
            },
            {
              "title_text@safe_zone.title_text": {
                "offset": [ 0, 9 ],
                "size": [ "default", 15 ],
                "anchor_to": "top_middle",
                "anchor_from": "top_middle"
              }
            },
            {
              "scrolling_panel@common.scrolling_panel": {
                "anchor_from": "top_left",
                "anchor_to": "top_left",
                "size": [ "100%-21px", "100%-67px" ],
                "offset": [ 10, 24 ],
                "$scrolling_pane_size": [ "100%", "100%" ],
                "$scrolling_pane_offset": [ 1, 0 ],
                "$scroll_size": [ 5, "100% - 4px" ],
                "$scrolling_content": "safe_zone.content_panel",
                "$scroll_bar_left_padding_size": [ 2, 0 ],
                "$scroll_bar_right_padding_size": [ 2, 0 ],
                "$show_background": false,
                "$bar_visible": true
              }
            },
            {
              "confirm_button@safe_zone.confirm_button": {
                "anchor_from": "bottom_middle",
                "anchor_to": "bottom_middle",
                "focus_change_down": "FOCUS_OVERRIDE_STOP",
                "offset": [ 0, -7 ]
              }
            }
          ]
        }
      }
    ],
    "button_mappings": [
      {
        "from_button_id": "button.menu_up",
        "to_button_id": "button.menu_up",
        "mapping_type": "global",
        "scope": "view"
      },
      {
        "from_button_id": "button.menu_down",
        "to_button_id": "button.menu_down",
        "mapping_type": "global",
        "scope": "view"
      },
      {
        "from_button_id": "button.menu_left",
        "to_button_id": "button.menu_left",
        "mapping_type": "global",
        "scope": "view"
      },
      {
        "from_button_id": "button.menu_right",
        "to_button_id": "button.menu_right",
        "mapping_type": "global",
        "scope": "view"
      },
      {
        "from_button_id": "button.menu_cancel",
        "to_button_id": "button.menu_exit",
        "mapping_type": "global"
      }
    ]
  }
}
