package com.ruoyi.busi.domain.vo;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.busi.domain.SysOrg;

/**
 * 司法行政机构树形下拉结构
 *
 * @author ruoyi
 */
public class SysOrgTreeSelect implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 节点编码 */
    private String id;

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

    /** 是否禁用（停用机构不可选） */
    private boolean disabled;

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

    public SysOrgTreeSelect()
    {
    }

    public SysOrgTreeSelect(SysOrg org)
    {
        this.id = org.getJgbm();
        this.label = org.getJgmc();
        this.disabled = org.getStatus() != null && org.getStatus() == 0;
        if (org.getChildren() != null && !org.getChildren().isEmpty())
        {
            this.children = org.getChildren().stream().map(SysOrgTreeSelect::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 boolean isDisabled()
    {
        return disabled;
    }

    public void setDisabled(boolean disabled)
    {
        this.disabled = disabled;
    }

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

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