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

import com.xunhong.erp.turbo.api.rbac.dto.cmd.MenuCreateCmd;
import com.xunhong.erp.turbo.api.rbac.dto.vo.MenuVO;
import com.xunhong.erp.turbo.rbac.app.assembler.MenuAssembler;
import com.xunhong.erp.turbo.rbac.domain.entity.Menu;
import com.xunhong.erp.turbo.rbac.domain.gateway.MenuGateway;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class MenuCreateCmdExe {
	private final MenuAssembler menuAssembler;

	private final MenuGateway menuGateway;

	public MenuVO execute(MenuCreateCmd menuCreateCmd) {
		Menu menu = menuGateway.create(menuCreateCmd);
		return menuAssembler.toMenuVO(menu);
	}
}
