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

import com.xunhong.erp.turbo.api.rbac.dto.cmd.RoleUpdateCmd;
import com.xunhong.erp.turbo.api.rbac.dto.vo.RoleVO;
import com.xunhong.erp.turbo.rbac.app.assembler.RoleAssembler;
import com.xunhong.erp.turbo.rbac.domain.entity.Role;
import com.xunhong.erp.turbo.rbac.domain.gateway.RoleGateway;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class RoleUpdateCmdExe {
	private final RoleGateway roleGateway;
	private final RoleAssembler roleAssembler;

	public RoleVO execute(RoleUpdateCmd roleUpdateCmd) {
		Role role = roleGateway.update(roleUpdateCmd);
		return roleAssembler.toRoleVO(role);
	}
}
