package de.effigenix.application.usermanagement.dto;

import de.effigenix.domain.usermanagement.Permission;
import de.effigenix.domain.usermanagement.Role;
import de.effigenix.domain.usermanagement.RoleName;

import java.util.Set;

/**
 * Data Transfer Object for Role.
 */
public record RoleDTO(
        String id,
        RoleName name,
        Set<Permission> permissions,
        String description
) {
    /**
     * Maps a Role entity to a RoleDTO.
     */
    public static RoleDTO from(Role role) {
        return new RoleDTO(
                role.id().value(),
                role.name(),
                role.permissions(),
                role.description()
        );
    }
}
