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

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

/**
 * @author wookvn
 *
 */
@Component
public class PlatomixScriptJavaTransform implements SeatunnelConnector<SeatunnelScriptJavaTransformConfig> {

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

	@Override
	public Object validate(String configJson) {
		SeatunnelScriptJavaTransformConfig config = EtlJsonUtil.parseJsonString(configJson, SeatunnelScriptJavaTransformConfig.class);
		ValidateUtil.validate(config);
		ValidateUtil.validate(config.getFields());
		return config;
	}

}
