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

import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxSpecCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxSpecVO;
import com.xunhong.erp.turbo.biz.app.assembler.BoxSpecAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.BoxSpec;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxSpecGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

    private final BoxSpecAssembler boxSpecAssembler;
    private final BoxSpecGateway boxSpecGateway;

    public BoxSpecVO execute(BoxSpecCreateCmd boxSpecCreateCmd) {
        BoxSpec boxSpec = boxSpecGateway.save(boxSpecCreateCmd);

        return boxSpecAssembler.toBoxSpecVO(boxSpec);
    }
}

