package com.eactive.eai.adapter.mapper;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.data.entity.onl.adapter.AdapterGroup;
import com.eactive.eai.data.mapper.BaseMapperConfig;
import com.eactive.eai.data.mapper.GenericMapper;
import com.eactive.eai.data.mapper.StringToBooleanMapper;
import com.eactive.eai.data.mapper.StringTrimMapper;

@Mapper(config = BaseMapperConfig.class)
public interface AdapterGroupMapper extends GenericMapper<AdapterGroupVO, AdapterGroup> {

	@Mapping(source = "adptrbzwkgroupname", target = "name")
	@Mapping(source = "adptrmsgptrncd", target = "adptrMsgPtrnCd")
	@Mapping(source = "eaibzwkdstcd", target = "eaiBizCode")
	@Mapping(source = "adptrcd", target = "type")
	@Mapping(source = "adptrmsgdstcd", target = "messageType")
	@Mapping(source = "adptriodstcd", target = "gubun")
	@Mapping(source = "refclsname", target = "refClass")
	@Mapping(source = "sndrcvhmslogyn", target = "srLogFlag", qualifiedBy = StringToBooleanMapper.class)
	@Mapping(source = "adptruseyn", target = "usedFlag", qualifiedBy = StringToBooleanMapper.class)
	@Mapping(source = "spcfcluuseyn", target = "spcfcLUUseYn", qualifiedBy = StringToBooleanMapper.class)
	@Mapping(source = "adptrbzwkgroupdesc", target = "description", qualifiedBy = StringTrimMapper.class)
	@Mapping(source = "osidinstino", target = "osidInstiNo", qualifiedBy = StringTrimMapper.class)
	@Mapping(source = "kesauseyn", target = "kesaUseYn", qualifiedBy = StringTrimMapper.class)
	@Mapping(source = "testmasteryn", target = "testMasterYn", qualifiedBy = StringTrimMapper.class)
	@Mapping(source = "adptrnickname", target = "adptrNickName", qualifiedBy = StringTrimMapper.class)
	@Mapping(source = "companycodedata", target = "companyCodeData", qualifiedBy = StringTrimMapper.class)
	@Mapping(source = "adptrinsticode", target = "adptrInstiCode", qualifiedBy = StringTrimMapper.class)
	@Mapping(source = "bidinterface", target = "bidInterface", qualifiedBy = StringTrimMapper.class)
	@Mapping(source = "msgencode", target = "messageEncode", qualifiedBy = StringTrimMapper.class)
	@Mapping(source = "linkedAdapterGroup", target = "linkedAdapterGroup")
	@Mapping(source = "sameSessionYn", target = "sameSessionYn")
	@Mapping(source = "pairAdapterYn", target = "pairAdapterYn")
	@Mapping(source = "clientId", target = "clientId")
	AdapterGroupVO toVo(AdapterGroup entity);

	@Mapping(target = "adapters", ignore = true)
	AdapterGroup toEntity(AdapterGroupVO vo);
}
