package com.ruoyi.framework.recovery.domain.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.framework.recovery.domain.RecBrand;
import io.swagger.v3.oas.annotations.media.Schema;

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

/**
 * Treeselect树结构实体类
 *
 * @author ruoyi
 */
@Schema(description = "Treeselect树结构实体类")
public class TreeSelectVo implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    @Schema(description = "节点ID")
    private Long id;

    /** 节点名称 */
    @Schema(description = "节点名称")
    private String label;

    /** 子节点 */
    @Schema(description = "子节点")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeSelectVo> children;

    public TreeSelectVo()
    {

    }

    public TreeSelectVo(RecBrand brand)
    {
        this.id = brand.getId();
        this.label = brand.getBrand();
        this.children = brand.getChildren().stream().map(TreeSelectVo::new).collect(Collectors.toList());
    }

    public Long getId()
    {
        return id;
    }

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

    public String getLabel()
    {
        return label;
    }

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

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

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