package com.eactive.eai.rms.onl.apim.approvalline;

import com.eactive.apim.portal.approvalline.entity.PortalApprovalLineUser;
import com.eactive.eai.data.mapper.GenericMapper;
import org.mapstruct.*;

@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface PortalApprovalLineUserUIMapper extends GenericMapper<PortalApprovalLineUserUI, PortalApprovalLineUser> {

	@Override
	@Mapping(target = "userId", source = "id.userId")
	@Mapping(target = "approvalLineId", source = "id.approvalLineId")
	@Mapping(target = "userName", source = "user.username")
	PortalApprovalLineUserUI toVo(PortalApprovalLineUser entity);

	@Override
	@InheritInverseConfiguration
	@Mapping(target = "user", ignore = true)
	PortalApprovalLineUser toEntity(PortalApprovalLineUserUI vo);

	@InheritInverseConfiguration
	@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
	@Mapping(target = "user", ignore = true)
	void updateToEntity(PortalApprovalLineUserUI portalApprovalLineUserUI, @MappingTarget PortalApprovalLineUser portalApprovalLineUser);

}
