package com.eactive.eai.rms.onl.apim.apigroup.mapping;

import com.eactive.eai.data.entity.onl.apim.apigroup.ApiGroup;
import com.eactive.eai.data.entity.onl.message.EAIMessageEntity;
import com.eactive.eai.data.mapper.BaseMapperConfig;
import com.eactive.eai.data.mapper.GenericMapper;
import com.eactive.eai.rms.onl.apim.apigroup.ui.ApiGroupUI;
import org.mapstruct.*;

import java.util.List;

@Mapper(config = BaseMapperConfig.class, uses = { ApiGroupApiUIMapper.class })
public interface ApiGroupUIMapper extends GenericMapper<ApiGroupUI, ApiGroup> {

    @Mapping(source = "apiGroupApiList", target = "apiGroupApiList")
    ApiGroupUI toVo(ApiGroup apiGroup);

    @Mapping(source = "eaiMessageEntityList", target = "apiGroupApiList")
    ApiGroupUI toVo(ApiGroup apiGroup, List<EAIMessageEntity> eaiMessageEntityList);

    @InheritInverseConfiguration
    ApiGroup toEntity(ApiGroupUI apiGroupUI);

    @InheritInverseConfiguration
    @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
    void updateToEntity(ApiGroupUI apiGroupUI, @MappingTarget ApiGroup apiGroup);
}
