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


import com.xunhong.erp.turbo.api.infra.dto.cmd.MaterialUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.vo.MaterialVO;
import com.xunhong.erp.turbo.infra.app.assembler.MaterialAssembler;
import com.xunhong.erp.turbo.infra.domain.entity.Material;
import com.xunhong.erp.turbo.infra.domain.gateway.MaterialGateway;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class MaterialUpdateCmdExe {

	private final MaterialGateway materialGateway;
	private final MaterialAssembler materialAssembler;

	public MaterialVO execute(MaterialUpdateCmd materialUpdateCmd) {
		Material material = materialGateway.update(materialUpdateCmd);
		return materialAssembler.toMaterialVO(material);
	}
}
