package com.bcxin.api.interfaces.rbacs.responses;

import lombok.Getter;

import java.io.Serializable;
import java.util.Collection;

@Getter
public class UserGetResponse implements Serializable {
    private final String id;
    private final String referencedId;
    private final String name;
    private final Collection<RoleItem> roles;

    public UserGetResponse(String id, String referencedId, String name, Collection<RoleItem> roles) {
        this.id = id;
        this.referencedId = referencedId;
        this.name = name;
        this.roles = roles;
    }

    public static UserGetResponse create(String id, String referencedId, String name, Collection<RoleItem> roles) {
        return new UserGetResponse(id, referencedId, name, roles);
    }

    @Getter
    public static class RoleItem implements Serializable {
        private final String id;
        private final String name;

        public RoleItem(String id, String name) {
            this.id = id;
            this.name = name;
        }

        public static RoleItem create(String id, String name) {
            return new RoleItem(id, name);
        }
    }
}
