package com.xinelu.manage.vo.agencycategory;

import com.fasterxml.jackson.annotation.JsonInclude;

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

/**
 * 机构类型树图信息对象vo agency
 *
 * @author zh
 * @date 2024-02-27
 */
public class AgencyCategoryTreeVO implements Serializable {

    private static final long serialVersionUID = 1L;

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

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

    private Long value;

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

    public AgencyCategoryTreeVO(AgencyCategoryVO agencyCategory) {
        this.id = agencyCategory.getId();
        this.label = agencyCategory.getCategoryName();
        this.value = agencyCategory.getValue();
        this.children = agencyCategory.getChildren().stream().map(AgencyCategoryTreeVO::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 Long getValue() {
        return value;
    }

    public void setValue(Long value) {
        this.value = value;
    }

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

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