/**
 * 
 */
package org.springblade.etl.connector.transform.config;

import java.util.List;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import org.springblade.etl.connector.base.SeatunnelConfig;
import org.springblade.etl.connector.transform.enums.ConnectionType;
import org.springblade.etl.connector.transform.enums.OperateType;
import org.springblade.etl.enums.ConditionDataType;

import com.fasterxml.jackson.annotation.JsonProperty;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author wookvn
 *
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class SeatunnelConditionTransformConfig extends SeatunnelConfig {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@JsonProperty("field_condition")
	@NotNull(message = "条件组件：条件不能为空")
	private List<FieldCondition> fieldCondition;
	
	@JsonProperty("connect_type")
	@ApiModelProperty("条件之间的关系")
	private ConnectionType connectType;

	@Data
	public static class FieldCondition {
		@NotEmpty(message = "条件组件：字段不能为空")
		@ApiModelProperty("字段名称")
		private String field;
		@NotNull(message = "条件组件：比较符号不能为空")
		@ApiModelProperty("比较符号")
		private OperateType operateType;
		@NotNull(message = "条件组件：数值不能为空")
		@ApiModelProperty("数值[支持：数字/日期/字符串]")
		private Object value;
		@ApiModelProperty("value是日期类型时，格式化方式")
		private String format;
		@ApiModelProperty("格式化类型")
		private ConditionDataType dataType;
	}
}
