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

import com.zhongshu.card.client.model.org.role.RoleModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 机构用户详情
 *
 * @author TRX
 * @date 2024/6/6
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrganizationUserSimpleModel {

    @Schema(description = "相关数据ID")
    private String id;

    @Schema(description = "机构oid")
    private String oid;

    @Schema(description = "机构名称")
    private String orgName;

    @Schema(description = "机构名称")
    private String name;

    public String getName() {
        if (StringUtils.isNotEmpty(name)) {
            return name;
        }
        return orgName;
    }

    @Schema(description = "工号")
    private String code;

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

    @Schema(description = "部门信息")
    private DepartmentModel department;

    @Schema(description = "部门信息所有级")
    private List<DepartmentModel> departments = new ArrayList<>();
}
