/**
 * 
 */
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.source.enums.FieldType;
import org.springblade.etl.connector.transform.enums.AddMode;

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

/**
 * @author wookvn
 *
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class SeatunnelColumnAddTransformConfig extends SeatunnelConfig {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@NotNull(message = "添加列组件：字段列表不能为空")
	private List<ColAddField> fields;
	
	@Data
	public static class ColAddField {
		@NotEmpty(message = "添加列组件：新加字段名不能为空")
		@ApiModelProperty("新添加列字段名")
		private String field;
		
		@NotEmpty(message = "添加列组件：计算公式不能为空")
		@ApiModelProperty("计算公式，占位符{}。比如：{price} * {number}")
		private String formula;
		
		@NotNull(message = "添加列组件：字段类型不能为空")
		@ApiModelProperty("字段类型")
		private FieldType fieldType;
		
		@ApiModelProperty("列添加模式")
		private AddMode addMode = AddMode.CALC;
	}
}
