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


import com.xunhong.erp.turbo.api.infra.dto.cmd.CategoryUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.vo.CategoryVO;
import com.xunhong.erp.turbo.infra.app.assembler.CategoryAssembler;
import com.xunhong.erp.turbo.infra.domain.entity.Category;
import com.xunhong.erp.turbo.infra.domain.gateway.CategoryGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class CategoryUpdateCmdExe {
	private final CategoryAssembler categoryAssembler;

	private final CategoryGateway categoryGateway;

	public CategoryVO execute(CategoryUpdateCmd categoryUpdateCmd) {
		Category category = categoryGateway.update(categoryUpdateCmd);
		return categoryAssembler.toCategoryVO(category);
	}
}
