package com.xunhong.erp.turbo.biz.app.executor.cmd;

import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxProductCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxProductVO;
import com.xunhong.erp.turbo.biz.app.assembler.BoxProductAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.BoxProduct;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxProductGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author shenyifei
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class BoxProductCreateCmdExe {

	private final BoxProductAssembler boxProductAssembler;
	private final BoxProductGateway boxProductGateway;

	public BoxProductVO execute(BoxProductCreateCmd boxProductCreateCmd) {
		BoxProduct boxProduct = boxProductGateway.save(boxProductCreateCmd);

		return boxProductAssembler.toBoxProductVO(boxProduct);
	}
}

