package com.ruoyi.interfaces.domain;

import com.fasterxml.jackson.annotation.JsonInclude;

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

public class TreeSelectString  implements Serializable{
    private static final long serialVersionUID = 1L;

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

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

    private PtService service;


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


    public TreeSelectString(MdDataCate menu)
    {
        this.id = menu.getCateId();
        this.label = menu.getItemName();
        this.nodeType = menu.getIcon();
        this.pid = menu.getCatePid();
        this.children = menu.getChildren().stream().map(TreeSelectString::new).collect(Collectors.toList());
    }

    public TreeSelectString(PtTreeCate menu)
    {
        this.id = menu.getTreeId();
        this.label = menu.getItemName();
        this.nodeType = menu.getNodeType();
        this.pid = menu.getTreePid();
        this.service = menu.getService();
        this.children = menu.getChildren().stream().map(TreeSelectString::new).collect(Collectors.toList());
    }


    public PtService getService() {
        return service;
    }

    public void setService(PtService service) {
        this.service = service;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getNodeType() {
        return nodeType;
    }

    public void setNodeType(String nodeType) {
        this.nodeType = nodeType;
    }

    public TreeSelectString(String id, String label, List<TreeSelectString> children) {
        this.id = id;
        this.label = label;
        this.children = children;
    }

    public TreeSelectString() {
    }

    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<TreeSelectString> getChildren() {
        return children;
    }

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