package com.eactive.eai.transformer.function.mapper;

import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import com.eactive.eai.data.entity.onl.transformer.function.Function;
import com.eactive.eai.data.mapper.BaseMapperConfig;
import com.eactive.eai.data.mapper.GenericMapper;
import com.eactive.eai.data.mapper.StringTrimMapper;
import com.eactive.eai.transformer.function.FunctionDefinition;

@Mapper(config = BaseMapperConfig.class, uses = { ParameterMapper.class })
public interface FunctionMapper extends GenericMapper<FunctionDefinition, Function> {

	@Mapping(source = "cnvsnfuntnname", target = "name")
	@Mapping(source = "cnvsnfuntndesc", target = "description")
	@Mapping(source = "cnvsnfuntnretunptrnidname", target = "returnTypeId")
	@Mapping(source = "cnvsnfuntnptrnidname", target = "functionTypeId")
	@Mapping(source = "cnvsnfuntnclsname", target = "functionClass", qualifiedBy = StringTrimMapper.class)
	@Mapping(source = "parameters", target = "parameterList")
	@Override
	FunctionDefinition toVo(Function entity);

	@InheritInverseConfiguration
	@Override
	Function toEntity(FunctionDefinition vo);

}
