package com.eactive.eai.rms.onl.manage.serviceinfo.company;

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.mapper.GenericMapper;
import com.eactive.eai.rms.data.entity.onl.company.Company;
import com.eactive.eai.rms.data.entity.onl.company.CompanyId;

@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface CompanyUIMapper extends GenericMapper<CompanyUI, Company> {

	@Override
	@Mapping(source = "id.groupCoCd", target = "groupCoCd")
	@Mapping(source = "id.companyCode", target = "companyCode")
	@Mapping(source = "id.appCode", target = "appCode")
	@Mapping(source = "id.bzwkDstCode", target = "bzwkDstcode")
	CompanyUI toVo(Company entity);

	@Override
	@InheritInverseConfiguration
	Company toEntity(CompanyUI vo);

	@Mapping(source = "bzwkDstcode", target = "bzwkDstCode")
	CompanyId toId(CompanyUI vo);

	@InheritInverseConfiguration
	@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
	void updateToEntity(CompanyUI companyUI, @MappingTarget Company company);

}
