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

import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.Dealer;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final DealerAssembler dealerAssembler;
	private final DealerGateway dealerGateway;

	public DealerVO execute(DealerUpdateCmd dealerUpdateCmd) {
		Dealer dealer = dealerGateway.update(dealerUpdateCmd);
		return dealerAssembler.toDealerVO(dealer);
	}
}
