package com.yunfeiyun.agmp.common.core.domain;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yunfeiyun.agmp.common.core.domain.entity.SysDept;
import com.yunfeiyun.agmp.common.core.domain.model.IBaseMenu;

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

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

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

    /** 节点类型 */
    private String treeType;

    /** 节点显示状态 */
    private String treeVisiblestatus;

    /** 节点可用状态 */
    private String treeStatus;

    /** 节点权限Key */
    private String treePerms;

    /** 接口状态 */
    private String treeApistatus;




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

    public TreeSelect()
    {

    }

    public TreeSelect(SysDept dept)
    {
        this.id = dept.getDeptId();
        this.label = dept.getDeptName();
        this.treeType = "-1";
        this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(IBaseMenu menu)
    {
        this.id = menu.getMenuId();
        this.label = menu.getMenuName();
        this.treeType = menu.getMenuType();
        this.treeVisiblestatus = menu.getMenuVisiblestatus();
        this.treeStatus = menu.getMenuStatus();
        this.treePerms = menu.getMenuPerms();
        this.treeApistatus = "-1".equals(this.treeType) ? "0" : menu.getMenuApistatus();
        this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }


    public String getId()
    {
        return id;
    }

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

    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 getTreeType() {
        return treeType;
    }

    public void setTreeType(String treeType) {
        this.treeType = treeType;
    }


    public String getTreeVisiblestatus() {
        return treeVisiblestatus;
    }

    public void setTreeVisiblestatus(String treeVisiblestatus) {
        this.treeVisiblestatus = treeVisiblestatus;
    }

    public String getTreeStatus() {
        return treeStatus;
    }

    public void setTreeStatus(String treeStatus) {
        this.treeStatus = treeStatus;
    }

    public String getTreePerms() {
        return treePerms;
    }

    public void setTreePerms(String treePerms) {
        this.treePerms = treePerms;
    }

    public String getTreeApistatus() {
        return treeApistatus;
    }

    public void setTreeApistatus(String treeApistatus) {
        this.treeApistatus = treeApistatus;
    }

}
