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

import com.xunhong.erp.turbo.api.infra.dto.cmd.PlatformCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.vo.PlatformVO;
import com.xunhong.erp.turbo.infra.app.assembler.PlatformAssembler;
import com.xunhong.erp.turbo.infra.domain.entity.Platform;
import com.xunhong.erp.turbo.infra.domain.gateway.PlatformGateway;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @author shenyifei
 */
@Component
@RequiredArgsConstructor
public class PlatformCreateCmdExe {
	private final PlatformAssembler platformAssembler;

	private final PlatformGateway platformGateway;

	public PlatformVO execute(PlatformCreateCmd platformCreateCmd) {
		Platform platform = platformGateway.save(platformCreateCmd);

		return platformAssembler.toPlatformVO(platform);
	}
}
