package com.zhongshu.card.client.model.org;

import com.google.common.collect.Lists;
import com.zhongshu.card.client.model.base.SuperModel;
import com.zhongshu.card.client.model.org.role.RoleModel;
import com.zhongshu.card.client.type.CertificateType;
import com.zhongshu.card.client.type.Sex;
import com.zhongshu.card.client.type.UserLoginType;
import com.zhongshu.card.client.type.UserState;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author TRX
 * @date 2024/5/31
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserCountAboutRoleModel extends UserCountModel {

    @Schema(description = "角色信息")
    private List<RoleModel> roles = new ArrayList<>();

    private List<String> roleIds;

    public List<String> getRoleIds() {
        if (ObjectUtils.isNotEmpty(roles)) {
            return roles.stream().map(it -> it.getId()).collect(Collectors.toUnmodifiableList());
        }
        return Lists.newArrayList();
    }

}
