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

import com.xunhong.erp.turbo.api.infra.dto.cmd.AgreementUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.vo.AgreementVO;
import com.xunhong.erp.turbo.infra.app.assembler.AgreementAssembler;
import com.xunhong.erp.turbo.infra.domain.entity.Agreement;
import com.xunhong.erp.turbo.infra.domain.gateway.AgreementGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final AgreementAssembler agreementAssembler;
	private final AgreementGateway agreementGateway;

	public AgreementVO execute(AgreementUpdateCmd agreementUpdateCmd) {
		Agreement agreement = agreementGateway.update(agreementUpdateCmd);
		return agreementAssembler.toAgreementVO(agreement);
	}
}
