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

import org.springblade.etl.connector.base.SeatunnelConnector;
import org.springblade.etl.connector.transform.config.SeatunnelTypeConversionTransformConfig;
import org.springblade.etl.util.ValidateUtil;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson2.JSON;

/**
 * @author wookvn
 *
 */
@Component
public class PlatomixTypeConversionTransform implements SeatunnelConnector<SeatunnelTypeConversionTransformConfig> {

	@Override
	public SeatunnelTypeConversionTransformConfig buildConfig(String configJson) {
		return (SeatunnelTypeConversionTransformConfig)validate(configJson);
	}

	@Override
	public Object validate(String configJson) {
		SeatunnelTypeConversionTransformConfig config = JSON.parseObject(configJson, SeatunnelTypeConversionTransformConfig.class);
		ValidateUtil.validate(config);
		ValidateUtil.validate(config.getConvertFields());
		return config;
	}
	
}
