/**
 * 
 */
package org.springblade.etl.connector.source;

import java.util.List;

import javax.validation.constraints.NotNull;

import org.springblade.etl.connector.base.SeatunnelConnector;
import org.springblade.etl.connector.source.config.SeatunnelJdbcSourceConfig;
import org.springblade.etl.util.EtlJsonUtil;
import org.springblade.etl.util.ValidateUtil;
import org.springframework.stereotype.Component;

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

/**
 * @author wookvn
 *
 */
@Component
public class PlatomixCubeSource implements SeatunnelConnector<SeatunnelJdbcSourceConfig>{

	@Data
	@ApiModel("数据集Source配置信息")
	public static class Config {
		@ApiModelProperty("数据集ID")
		@NotNull(message = "Source数据源不能为空")
		private Integer cubeDataId;
		
		@ApiModelProperty("数据集的字段列表")
		@NotNull(message = "Source字段列表不能为空")
		private List<String> columnFields;
	}

	@Override
	public SeatunnelJdbcSourceConfig buildConfig(String configJson) {
		Config ptConfig = (Config)validate(configJson);
		return null;
	}

	@Override
	public Object validate(String configJson) {
		Config ptConfig = EtlJsonUtil.parseJsonString(configJson, PlatomixCubeSource.Config.class);
		ValidateUtil.validate(ptConfig);
		return ptConfig;
	}
}
