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

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

/**
 * @author wookvn
 *
 */
@Component
public class PlatomixConditionTransform implements SeatunnelConnector<SeatunnelConditionTransformConfig> {
	
	@Override
	public SeatunnelConditionTransformConfig buildConfig(String configJson) {
		return (SeatunnelConditionTransformConfig)validate(configJson);
	}

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