package cn.reghao.tnb.search.esapp.model.vo;

import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * @author reghao
 * @date 2025-08-20 14:27:11
 */
@Getter
@Setter
public class ElasticQuery {
    private int pageSize;
    private int pageNumber;
    private String indexName;
    private List<String> queryFiledNames;
    private List<String> highlightFiledNames;
    private String queryString;

    public ElasticQuery() {
        this.pageSize = 10;
        this.pageNumber = 1;
    }

    private ElasticQuery(Builder builder) {
        this.pageSize = builder.pageSize;
        this.pageNumber = builder.pageNumber;
        this.indexName = builder.indexName;
        this.queryFiledNames = builder.queryFiledNames;
        this.highlightFiledNames = builder.highlightFiledNames;
        this.queryString = builder.queryString;
    }

    public static final class Builder {
        private int pageSize;
        private int pageNumber;
        private String indexName;
        private List<String> queryFiledNames;
        private List<String> highlightFiledNames;
        private String queryString;

        public Builder pageSize(int pageSize) {
            this.pageSize = pageSize;
            return this;
        }

        public Builder pageNumber(int pageNumber) {
            this.pageNumber = pageNumber;
            return this;
        }

        public Builder indexName(String indexName) {
            this.indexName = indexName;
            return this;
        }

        public Builder queryFiledNames(List<String> queryFiledNames) {
            this.queryFiledNames = queryFiledNames;
            return this;
        }

        public Builder highlightFiledNames(List<String> highlightFiledNames) {
            this.highlightFiledNames = highlightFiledNames;
            return this;
        }

        public Builder queryString(String queryString) {
            this.queryString = queryString;
            return this;
        }

        public ElasticQuery build() {
            return new ElasticQuery(this);
        }
    }
}
