{
  "namespace": "purchase_common",


  //--------------------------------------------------------------------------------
  // Common Controls
  //--------------------------------------------------------------------------------

  "banner_fill": {
    "type": "image",
    "texture": "textures/ui/Banners",
    "layer": 1
  },

  "banner_empty": {
    "type": "image",
    "texture": "textures/ui/BannersTransparent"
  },

  "screenshots_grid_item": {
    "type": "panel",
    "size": [ "177.78%y", "100%" ],
    "controls": [
      {
        "frame@banner_empty": {
          "size": [ "177.78%y - 1.558815625px", "100% - 2px" ],
          "layer": 1,
          "controls": [
            {
              "screenshot_image": {
                "type": "image",
                "layer": 1,
                "size": [ "100% - 2px", "100% - 2px" ],
                "bindings": [
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "category_collection",
                    "binding_name": "#screenshot_texture_name",
                    "binding_name_override": "#texture"
                  },
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "category_collection",
                    "binding_name": "#screenshot_texture_file_system",
                    "binding_name_override": "#texture_file_system"
                  }
                ]
              }
            },
            {
              "progress_loading@common_store.progress_loading": {
                "layer": 5,
                "$source_control_name": "screenshot_image",
                "$source_property_name": "(#texture = '')",
                "$hide_failure_text": true
              }
            },
            {
              "screenshot_button@common.button": {
                "layer": 4,
                "size": [ "100%", "100%" ],
                "focus_enabled": true,
                "default_control": "",
                "hover_control": "hover",
                "pressed_control": "pressed",
                "bindings": [
                  {
                    "binding_type": "collection_details",
                    "binding_collection_name": "category_collection"
                  },
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "category_collection",
                    "binding_name": "#grid_button_focus_id",
                    "binding_name_override": "#focus_identifier"
                  },
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "category_collection",
                    "binding_name": "#grid_button_override_right",
                    "binding_name_override": "#focus_change_right"
                  },
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "category_collection",
                    "binding_name": "#grid_button_override_left",
                    "binding_name_override": "#focus_change_left"
                  },
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "category_collection",
                    "binding_name": "#grid_button_override_up",
                    "binding_name_override": "#focus_change_up"
                  }
                ],
                "button_mappings": [
                  {
                    "from_button_id": "button.menu_select",
                    "to_button_id": "button.select_screenshot",
                    "mapping_type": "pressed"
                  },
                  {
                    "from_button_id": "button.menu_ok",
                    "to_button_id": "button.select_screenshot",
                    "mapping_type": "pressed"
                  }
                ],
                "controls": [
                  {
                    "hover@common.focus_border_white": {
                    }
                  },
                  {
                    "pressed@common.focus_border_white": {
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  },

  "screenshots_grid": {
    "type": "grid",
    "anchor_from": "center",
    "anchor_to": "center",
    "size": [ "100%c", "100% - 4px" ],
    "grid_item_template": "purchase_common.screenshots_grid_item",
    "grid_dimension_binding": "#screenshots_grid_dimensions",
    "collection_name": "category_collection",
    "bindings": [
      {
        "binding_name": "#screenshots_grid_dimensions"
      }
    ]
  },

  "key_image_frame@banner_empty": {
    "anchor_from": "center",
    "anchor_to": "center",
    "offset": [ 0, 0 ],
    "size": [ "100%", "100%" ],
    "layer": 1,
    "controls": [
      {
        "zoomed": {
          "type": "image",
          "layer": 1,
          "size": [ "100% - 2px", "100% - 2px" ],
          "bindings": [
            {
              "binding_name": "#zoomed_texture_name",
              "binding_name_override": "#texture"
            },
            {
              "binding_name": "#zoomed_texture_file_system",
              "binding_name_override": "#texture_file_system"
            }
          ]
        }
      }
    ]
  },

  "offer_grid_item": {
    "type": "panel",
    "size": [ "default", "100% - 6px" ],
    "controls": [
      {
        "frame@purchase_common.banner_fill": {
          "size": [ "100% - 2px", "100%" ],
          "layer": 3,
          "controls": [
            {
              "offer_key_art": {
                "type": "image",
                "layer": 5,
                "size": [ "100% - 2px", "100% - 2px" ],
                "bindings": [
                  {
                    "binding_type": "collection_details",
                    "binding_collection_name": "category_collection",
                    "binding_collection_prefix": "category"
                  },
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "offer_collection",
                    "binding_name": "#offer_texture_name",
                    "binding_name_override": "#texture"
                  },
                  {
                    "binding_type": "collection",
                    "binding_collection_name": "offer_collection",
                    "binding_name": "#offer_texture_file_system",
                    "binding_name_override": "#texture_file_system"
                  }
                ]
              }
            },
            {
              "offer_button": {
                "type": "button",

                "$focus_id|default": "",
                "$focus_override_down|default": "",
                "$focus_override_up|default": "",
                "$focus_override_left|default": "",
                "$focus_override_right|default": "",
                "focus_identifier": "$focus_id",
                "focus_change_down": "$focus_override_down",
                "focus_change_up": "$focus_override_up",
                "focus_change_left": "$focus_override_left",
                "focus_change_right": "$focus_override_right",
                "focus_enabled": true,

                "layer": 4,
                "default_control": "",
                "hover_control": "hover",
                "pressed_control": "pressed",
                "bindings": [
                  {
                    "binding_type": "collection_details",
                    "binding_collection_name": "category_collection",
                    "binding_collection_prefix": "category"
                  },
                  {
                    "binding_type": "collection_details",
                    "binding_collection_name": "offer_collection",
                    "binding_collection_prefix": "offers"
                  }
                ],
                "button_mappings": [
                  {
                    "from_button_id": "button.menu_select",
                    "to_button_id": "button.select_offer",
                    "mapping_type": "pressed"
                  },
                  {
                    "from_button_id": "button.menu_ok",
                    "to_button_id": "button.select_offer",
                    "mapping_type": "pressed"
                  }
                ],
                "controls": [
                  {
                    "hover@common.square_image_border_white": {
                    }
                  },
                  {
                    "pressed@common.square_image_border_white": {
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    ],
    "bindings": [
      {
        "binding_type": "collection_details",
        "binding_collection_name": "category_collection",
        "binding_collection_prefix": "category"
      },
      {
        "binding_type": "collection",
        "binding_collection_name": "offer_collection",
        "binding_name": "#valid_offer_index",
        "binding_name_override": "#visible"
      }
    ]
  },

  "offer_grid": {
    "type": "grid",
    "size": [ "100%c", "100%" ],
    "offset": [ 0, 3 ],
    "grid_item_template": "store.offer_grid_item",
    "grid_dimension_binding": "#offer_grid_dimensions",
    "collection_name": "offer_collection",
    "bindings": [
      {
        "binding_name": "#offer_grid_dimensions"
      }
    ]
  },

  //--------------------------------------------------------------------------------
  // Root Controls
  //--------------------------------------------------------------------------------

  "key_art_and_text": {
    "type": "stack_panel",
    "size": [ "100%", "fill" ],
    "orientation": "horizontal",
    "controls": [
      {
        "key_image_panel": {
          "type": "input_panel",
          "size": [ "177.78%y - 1.5px", "100%" ],
          "controls": [
            { "key_image@key_image_frame": {} }
          ]
        }
      },
      {
        "padding": {
          "type": "panel",
          "size": [ 2, 0 ]
        }
      },
      {
        "description_scroll@common.scrolling_panel": {
          "$show_background": false,
          "size": [ "fill", "100%" ],
          "$scrolling_content": "purchase_common.pack_description",
          "$scroll_size": [ 5, "100% - 4px" ],
          "$scrolling_pane_size": [ "100% - 4px", "100%" ],
          "$scrolling_pane_offset": [ 2, 0 ],
          "$scroll_bar_right_padding_size": [ 0, 0 ]
        }
      }
    ]
  },

  "pack_description": {
    "type": "label",
    "color": "$body_text_color",
    "size": [ "100%", "default" ],
    "text": "#pack_description",
    "font_type": "smooth",
    "shadow": true,
    "layer": 1,
    "bindings": [
      {
        "binding_name": "#pack_description",
        "binding_type": "global"
      }
    ]
  }

}