package com.ruoyi.tuya.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;

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

    /** 模块ID */
    private String channelId;

    /** 栏目ID */
    private String categoryId;

    /** 父节点ID */
    private String parentId;

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

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

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

    public TreeSelectS()
    {

    }

    public TreeSelectS(TuyaSitesInfo site)
    {
        this.parentId = "0";
        this.id = site.getSiteId().toString();
        this.label = site.getSiteNameCn();
        this.children = site.getChildren().stream().map(TreeSelectS::new).collect(Collectors.toList());
    }
    public TreeSelectS(TuyaCategoryInfo categorys)
    {
        this.channelId = categorys.getChannelId().toString();
        this.categoryId = categorys.getCategoryId().toString();
        this.parentId = categorys.getParentId().toString();
        this.id = categorys.getCategoryId().toString();
        this.label = categorys.getCategoryName();
        this.children = categorys.getChildren().stream().map(TreeSelectS::new).collect(Collectors.toList());
    }

    public String getChannelId()
    {
        return channelId;
    }

    public void setChannelId(String channelId)
    {
        this.channelId = channelId;
    }

    public String getCategoryId()
    {
        return categoryId;
    }

    public void setCategoryId(String categoryId)
    {
        this.categoryId = categoryId;
    }

    public String getParentId()
    {
        return parentId;
    }

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

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

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