
package com.eactive.eai.rms.onl.manage.authserver.scope;

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.authserver.ScopeEntity;
import com.eactive.eai.data.entity.onl.authserver.ScopeEntityId;
import com.eactive.eai.data.mapper.GenericMapper;

@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ApiScopeUIMapper extends GenericMapper<ApiScopeUI, ScopeEntity> {

	@Override
	@Mapping(source = "id.bzwksvckeyname", target = "bzwkSvcKeyName")
	@Mapping(source = "id.scopeid", target = "scopeId")
	ApiScopeUI toVo(ScopeEntity entity);

	@Override
	@InheritInverseConfiguration
	ScopeEntity toEntity(ApiScopeUI vo);

	@Mapping(source = "bzwkSvcKeyName", target = "bzwksvckeyname")
	@Mapping(source = "scopeId", target = "scopeid")
	ScopeEntityId toId(ApiScopeUI vo);

	@InheritInverseConfiguration
	@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
	void updateToEntity(ApiScopeUI apiScopeUI, @MappingTarget ScopeEntity scopeEntity);

}