package com.eactive.eai.rms.common.mmilog;

import org.mapstruct.BeanMapping;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;

import com.eactive.eai.data.mapper.GenericMapper;
import com.eactive.eai.rms.data.entity.onl.mmilog.MMILog;
import com.eactive.eai.rms.data.entity.onl.mmilog.MMILogId;

@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface MMILogUIMapper extends GenericMapper<MMILogUI, MMILog> {

	@Override
	@Mapping(source = "id.eaiSvcName", target = "eaiSvcName")
	@Mapping(source = "id.msgDpstHms", target = "msgDpstHMS")
	MMILogUI toVo(MMILog entity);

	@Override
	@InheritInverseConfiguration
	MMILog toEntity(MMILogUI vo);

	@Mapping(source = "eaiSvcName", target = "eaiSvcName")
	@Mapping(source = "msgDpstHMS", target = "msgDpstHms")
	MMILogId toId(MMILogUI vo);

	@InheritInverseConfiguration
	@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
	void updateToEntity(MMILogUI mmiLogUI, @MappingTarget MMILog mmiLog);
}
