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

import com.xunhong.erp.turbo.api.infra.dto.cmd.ChannelUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.vo.ChannelVO;
import com.xunhong.erp.turbo.infra.app.assembler.ChannelAssembler;
import com.xunhong.erp.turbo.infra.domain.entity.Channel;
import com.xunhong.erp.turbo.infra.domain.gateway.ChannelGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class ChannelUpdateCmdExe {
	private final ChannelGateway channelGateway;
	private final ChannelAssembler channelAssembler;

	public ChannelVO execute(ChannelUpdateCmd channelUpdateCmd) {
		Channel channel = channelGateway.update(channelUpdateCmd);
		return channelAssembler.toChannelVO(channel);
	}
}
