package com.eactive.eai.rms.onl.manage.inflow.inflow;

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.entity.onl.inflow.InflowControl;
import com.eactive.eai.data.mapper.GenericMapper;
import com.eactive.eai.rms.data.entity.onl.inflow.InflowControlServiceDto;

@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface InflowControlManMapper extends GenericMapper<InflowControlManUI, InflowControl> {
	@Override
	@Mapping(source = "id.name", target = "name")
	@Mapping(source = "id.type", target = "type")
	@Mapping(source = "thresholdpersecond", target = "thresholdPerSecond")
	@Mapping(source = "thresholdtimeunit", target = "thresholdTimeUnit")
	@Mapping(source = "useyn", target = "useYn")
	InflowControlManUI toVo(InflowControl entity);

	@Override
	@InheritInverseConfiguration
	InflowControl toEntity(InflowControlManUI vo);
	
	@InheritInverseConfiguration
	@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
	void updateToEntity(InflowControlManUI vo, @MappingTarget InflowControl entity);

	@Mapping(source = "id.name", target = "name")
	@Mapping(source = "id.type", target = "type")
	@Mapping(source = "thresholdpersecond", target = "thresholdPerSecond")
	@Mapping(source = "thresholdtimeunit", target = "thresholdTimeUnit")
	@Mapping(source = "useyn", target = "useYn")
	InflowControlServiceDto toDto(InflowControl entity);

	InflowControlManUI toVo(InflowControlServiceDto serviceDto);
	
}
