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

import com.xunhong.erp.turbo.api.biz.dto.cmd.GiftBoxCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.GiftBoxVO;
import com.xunhong.erp.turbo.biz.app.assembler.GiftBoxAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.GiftBox;
import com.xunhong.erp.turbo.biz.domain.gateway.GiftBoxGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final GiftBoxAssembler giftBoxAssembler;
	private final GiftBoxGateway giftBoxGateway;

	public GiftBoxVO execute(GiftBoxCreateCmd giftBoxCreateCmd) {
		GiftBox giftBox = giftBoxGateway.save(giftBoxCreateCmd);

		return giftBoxAssembler.toGiftBoxVO(giftBox);
	}
}

