package com.eactive.eai.rms.onl.transaction.tracking;

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

import com.eactive.eai.data.entity.onl.logger.EAILog;
import com.eactive.eai.data.mapper.BaseMapperConfig;
import com.eactive.eai.data.mapper.GenericMapper;
import com.eactive.eai.rms.data.entity.onl.logger.EAILogDto;

@Mapper(config = BaseMapperConfig.class)
public interface EAILogUIMapper extends GenericMapper<EAILogUI, EAILog> {

	@Mapping(source = "id.eaibzwkdstcd", target = "eaibzwkdstcd")
	@Mapping(source = "id.eaisvcserno", target = "eaisvcserno")
	@Mapping(source = "id.logprcssserno", target = "logprcssserno")
	@Mapping(source = "id.msgdpstyms", target = "msgdpstyms")
	@Override
	EAILogUI toVo(EAILog entity);

	@InheritInverseConfiguration
	@Override
	EAILog toEntity(EAILogUI vo);

	default EAILogUI toVo(EAILogDto dto) {
		EAILogUI ui = toVo(dto.getEaiLog());
		ui.setEaisvcdesc(dto.getEaiSvcDesc());
		return ui;
	}
}
