scenarios:
  search-categories:
    default-address: ${host}
    data-sources: # list of external data sources
      - path: test/resources/categories.csv  # this is a full form
        delimiter: ';'
        quoted: false
        encoding: "utf-8"
        loop: true
        variable-names: category-id
        random-order: true
        sharing-mode: "Current thread group"
    variables:
      currentPage: 0
      totalPages: 1
    requests:
      - while: ${__jexl3(${currentPage}<${totalPages})}
        do:
          - set-variables:
             currentCategoryId: ${category-id}
          - url: "${base_path}/categories/${currentCategoryId}"
            label: "pulling a category: ${currentCategoryId}"
            body:
              currentPage: "${currentPage}"
              pageSize: 10
              fields: FULL
            method: GET
            debug: true
            extract-jsonpath:
              internalCurrentPage:
                jsonpath: $.pagination.currentPage
                from-variable: internalCurrentPage
                default: 10000
              internalTotalPages:
                jsonpath: $.pagination.totalPages
                from-variable: internalTotalPages
                default: 1
          - set-variables:
              currentPage: ${__intSum(1,${internalCurrentPage})}
              totalPages: ${internalTotalPages}