package com.mvc.model.sldh;

import com.mvc.othermodel.GroupAndStationTree;

import java.util.List;

/**
 * 水利大会树模型
 */
public class SLDHTreeModel implements java.io.Serializable {
    private String key;//键
    private String label;//标签
    private String type;//类型(0单位,1站点)
    private List<SLDHTreeModel> children;//子节点

    public SLDHTreeModel() {
    }

    public SLDHTreeModel(GroupAndStationTree groupAndStationTree) {
        this.key = groupAndStationTree.getCode();
        this.label = groupAndStationTree.getLabel();
        this.type = groupAndStationTree.getType().equals("0") ? "0" : "1";
        List<SLDHTreeModel> treeList = new java.util.ArrayList<>();
        if (groupAndStationTree.getData() != null) {
            List<GroupAndStationTree> children = (List<GroupAndStationTree>) groupAndStationTree.getData();
            for (GroupAndStationTree child : children) {
                treeList.add(new SLDHTreeModel(child));
            }
        }
        this.children = treeList;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getLabel() {
        return label;
    }

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

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

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

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