{#
  Copyright (C) 2020 CERN.
  Copyright (C) 2020 Northwestern University.

  Invenio App RDM is free software; you can redistribute it and/or modify it
  under the terms of the MIT License; see LICENSE file for more details.
#}
{%- extends config.BASE_TEMPLATE %}

{%- block javascript %}
    {{ super() }}
    {{ webpack['rdm_search_app.js'] }}
{%- endblock %}

{%- block page_body %}
<!-- TODO: Auto-generate for new API -->
<div data-invenio-search-config='{
  "aggs": [
    {
      "aggName": "access_right",
      "field": "access_right",
      "title": "Access Right"
    },
    {
      "aggName": "resource_type",
      "field": "resource_type",
      "title": "Resource Type"
    }
  ],
  "appId": "rdm-search",
  "initialQueryState": {
    "hiddenParams": null
  },
  "layoutOptions": {
    "gridView": true,
    "listView": true
  },
  "paginationOptions": {
    "defaultValue": 10,
    "resultsPerPage": [
      {
        "text": "10",
        "value": 10
      },
      {
        "text": "20",
        "value": 20
      },
      {
        "text": "50",
        "value": 50
      }
    ]
  },
  "searchApi": {
    "axios": {
      "headers": {
        "Accept": "application/json"
      },
      "url": "/api/records",
      "withCredentials": true
    }
  },
  "sortOptions": [
    {
      "default": true,
      "defaultOnEmptyString": false,
      "sortBy": "bestmatch",
      "sortOrder": "asc",
      "text": "Best match"
    },
    {
      "default": false,
      "defaultOnEmptyString": true,
      "sortBy": "newest",
      "sortOrder": "asc",
      "text": "Newest"
    }
  ]
}'></div>

{%- endblock page_body %}
