package cn.freemud.demo.adapter.manager;

import cn.freemud.demo.entities.bo.promotion.GetActivityBO;
import cn.freemud.demo.entities.bo.promotion.GetCalculationDiscountBO;
import cn.freemud.demo.entities.bo.goods.QueryActivityByTypeDTO;
import cn.freemud.entities.dto.calculate.ActivityCalculationDiscountRequestDto;
import cn.freemud.utils.BeanUtil;
import ma.glasnost.orika.MapperFacade;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class PromotionBO2DTOAdapter {


    @Resource
    private MapperFacade mapperFacade;


    public ActivityCalculationDiscountRequestDto convert2CalculationSharingDiscountRequestDto(GetCalculationDiscountBO getProductStock) {

        ActivityCalculationDiscountRequestDto dto = BeanUtil.convertBean(getProductStock, ActivityCalculationDiscountRequestDto::new);
        return dto;
    }

    public QueryActivityByTypeDTO convert2QueryActivityByTypeDTO(GetActivityBO getActivityBO) {

        // QueryActivityByTypeDTO dto = mapperFacade.map(getActivityBO, QueryActivityByTypeDTO.class);

        QueryActivityByTypeDTO dto = BeanUtil.convertBean(getActivityBO, QueryActivityByTypeDTO::new);
        return dto;
    }

}
