package com.arms.egovframework.javaservice.esframework.model.dto.esquery;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class CompositeSourceDTO {

	private String fieldAlias;

	private String field;

	private boolean isAscending;

	private DocFiledType filedType;

	public static CompositeSourceDTOBuilder builder() {
		return new CompositeSourceDTOBuilder();
	}

	public static class CompositeSourceDTOBuilder {
		private String fieldAlias;
		private String field;
		private boolean isAscending = false;
		private DocFiledType filedType = DocFiledType.Terms;

		public CompositeSourceDTOBuilder fieldAlias(String fieldAlias) {
			this.fieldAlias = fieldAlias;
			return this;
		}

		public CompositeSourceDTOBuilder field(String field) {
			this.field = field;
			return this;
		}

		public CompositeSourceDTOBuilder field(DocFiledType filedType) {
			this.filedType = filedType;
			return this;
		}

		public CompositeSourceDTOBuilder isAscending(boolean isAscending) {
			this.isAscending = isAscending;
			return this;
		}

		public CompositeSourceDTO build() {
			CompositeSourceDTO dto = new CompositeSourceDTO();
			dto.setFieldAlias(this.fieldAlias);
			dto.setField(this.field);
			dto.setAscending(this.isAscending);
			dto.setFiledType(this.filedType);
			return dto;
		}
	}
}
