1 package de.dlr.shepard.neo4Core.io;
2
3 import de.dlr.shepard.neo4Core.entities.User;
4 import de.dlr.shepard.neo4Core.entities.UserGroup;
5 import jakarta.validation.constraints.NotNull;
6 import lombok.Data;
7 import lombok.EqualsAndHashCode;
8 import lombok.NoArgsConstructor;
9 import org.eclipse.microprofile.openapi.annotations.media.Schema;
10
11 @Data
12 @EqualsAndHashCode(callSuper = true)
13 @NoArgsConstructor
14 @Schema(name = "UserGroup")
15 public class UserGroupIO extends BasicEntityIO {
16
17 @NotNull
18 @Schema(required = true)
19 private String[] usernames;
20
21 public UserGroupIO(UserGroup userGroup) {
22 super(userGroup);
23 this.usernames = userGroup.getUsers().stream().map(User::getUsername).toArray(String[]::new);
24 }
25 }