// Package query ... For keeping data consistency in the same scope, we have to use the scroll way to search data from elasticsearch
// First time, it return scrollID, and we search data by scrollID util there is no data or the scope over
package query

import (
	"sync"

	"github.com/elastic/go-elasticsearch/v6"
)

//TODO it is a complex implement
type scroll struct {
	client    *elasticsearch.Client
	indices   []string
	keepAlive string
	body      interface{}
	size      *int
	pretty    bool
	mu        sync.RWMutex
	scrollID  string
}

//TODO
//first takes the first page of search results.
func (s *scroll) first() (*QueryResponse, error) {

	return nil, nil
}

//TODO
func (s *scroll) next() (*QueryResponse, error) {
	nextScrollID := s.scrollID
	if nextScrollID == "" {
		return s.first()
	}

	return nil, nil
}
