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

import com.xunhong.erp.turbo.api.biz.dto.cmd.ExpenseRecordUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.ExpenseRecordVO;
import com.xunhong.erp.turbo.biz.app.assembler.ExpenseRecordAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.ExpenseRecord;
import com.xunhong.erp.turbo.biz.domain.gateway.ExpenseRecordGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

    private final ExpenseRecordAssembler expenseRecordAssembler;
    private final ExpenseRecordGateway expenseRecordGateway;

    public ExpenseRecordVO execute(ExpenseRecordUpdateCmd expenseRecordUpdateCmd) {
        ExpenseRecord expenseRecord = expenseRecordGateway.update(expenseRecordUpdateCmd);
        return expenseRecordAssembler.toExpenseRecordVO(expenseRecord);
    }
}
