/**
 * 
 */
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.DataFormat;

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 SeatunnelTypeConversionTransformConfig extends SeatunnelConfig {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@JsonProperty("filter_field")
	@NotNull(message = "类型转换组件：转换字段不能为空")
	private List<ConvertField> convertFields;
	
	@Data
	public static class ConvertField{
		@NotEmpty(message = "类型转换组件：字段名不能为空")
		@ApiModelProperty("需要转换的字段名")
		private String column;
		
		@NotNull(message = "类型转换组件：字段名转换成的类型")
		@ApiModelProperty("转换成什么类型，目前仅支持：string,int,bigint,date,boolean,double")
		private FieldType conversionType;
		
		@ApiModelProperty("格式化的类型是否日期")
		private Boolean isDate;
		
		@ApiModelProperty("格式化的方式")
		private DataFormat dataFormat;
	}
}

