package com.eactive.eai.common.message.mapper;

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

import com.eactive.eai.common.message.ServiceMessage;
import com.eactive.eai.data.entity.onl.message.EAIReferenceMessage;
import com.eactive.eai.data.mapper.BaseMapperConfig;
import com.eactive.eai.data.mapper.GenericMapper;

@Mapper(config = BaseMapperConfig.class)
public interface EAIReferenceMessageMapper extends GenericMapper<ServiceMessage, EAIReferenceMessage> {
	@Mapping(source = "id.eaisvcname", target = "EAISvcCd")
	@Mapping(source = "id.svcprcssno", target = "svcPssSeq")
	@Mapping(target = "id.refmsgidno", expression = "java(mapRefMsgIDsToRefMsgIdNo(vo.getRefMsgIDs())")
	@Override
	ServiceMessage toVo(EAIReferenceMessage entity);

	@InheritInverseConfiguration
	EAIReferenceMessage toEntity(ServiceMessage vo);
}
