package com.xunhong.erp.turbo.biz.infrastructure.convert;

import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxBrandCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxBrandUpdateCmd;
import com.xunhong.erp.turbo.biz.domain.entity.BoxBrand;
import com.xunhong.erp.turbo.biz.infrastructure.entity.BoxBrandDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValueCheckStrategy;

/**
 * @author shenyifei
 */
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface BoxBrandConvert {

	@Mapping(target = "boxSpecList", source = "boxSpecDOList")
	@Mapping(target = "boxProductList", source = "boxProductDOList")
	BoxBrand toBoxBrand(BoxBrandDO boxBrandDO);

	@Mapping(target = "boxSpecDOList", ignore = true)
	@Mapping(target = "sort", ignore = true)
	@Mapping(target = "boxProductDOList", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	BoxBrandDO toBoxBrandDO(BoxBrandCreateCmd boxBrandCreateCmd);

	@Mapping(target = "boxSpecDOList", ignore = true)
	@Mapping(target = "sort", ignore = true)
	@Mapping(target = "boxProductDOList", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	void toBoxBrandDO(@MappingTarget BoxBrandDO boxBrandDO, BoxBrandUpdateCmd boxBrandUpdateCmd);
}

