package com.bonus.system.domain.vo;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

import com.bonus.system.api.domain.SysMenu;
import com.bonus.system.api.domain.SysUser;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.bonus.system.api.domain.SysDept;

/**
 * Treeselect树结构实体类
 *
 * @author bonus
 */
public class TreeSelect implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 节点ID
     */
    private Long id;

    /** 父部门ID */
    private Long parentId;

    /**
     * 节点名称
     */
    private String label;

    private String status;

    private Integer level;


    /**
     * 子节点
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeSelect> children;

    public TreeSelect() {

    }

    public TreeSelect(SysDept dept) {
        this.id = dept.getDeptId();
        this.parentId = dept.getParentId();
        this.status = dept.getStatus();
        this.label = dept.getDeptName();
        this.level = dept.getLevel();
        this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(SysMenu menu) {
        this.id = menu.getMenuId();
        this.label = menu.getMenuName();
        this.status = menu.getStatus();
        this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public List<TreeSelect> getChildren() {
        return children;
    }

    public void setChildren(List<TreeSelect> children) {
        this.children = children;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}
