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

import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyPaymentAccountCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyPaymentAccountVO;
import com.xunhong.erp.turbo.biz.app.assembler.CompanyPaymentAccountAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.CompanyPaymentAccount;
import com.xunhong.erp.turbo.biz.domain.gateway.CompanyPaymentAccountGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final CompanyPaymentAccountAssembler companyPaymentAccountAssembler;
	private final CompanyPaymentAccountGateway companyPaymentAccountGateway;

	public CompanyPaymentAccountVO execute(CompanyPaymentAccountCreateCmd companyPaymentAccountCreateCmd) {
		CompanyPaymentAccount companyPaymentAccount = companyPaymentAccountGateway.save(companyPaymentAccountCreateCmd);

		return companyPaymentAccountAssembler.toCompanyPaymentAccountVO(companyPaymentAccount);
	}
}

