package   cn.wise.sc.energy.power.plant.business.opentsdb.bean;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.opentsdb.client.api.BaseRequest;

import java.util.ArrayList;
import java.util.List;

/**
 * 查询请求类,用于实现queries的链式封装m
 * @author neo.shu
 * @since 2020/4/28 19:04
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class QueryRequestExt extends BaseRequest {

    private String start;
    private String end;
    private List<QueryExt> queries=new ArrayList<>();
    private Boolean noAnnotations;
    private Boolean globalAnnotations;
    private Boolean msResolution;
    private Boolean showTSUIDs;
    private Boolean showStats;
    private Boolean showQuery;
    private String timezone;
    private Boolean useCalendar;

    public QueryRequestExt addQuery(QueryExt query){
        if (getQueries() == null) {
            setQueries(new ArrayList<>());
        }
        getQueries().add(query);
        return this;
    }
}
