package com.xinelu.manage.vo.agency;

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-26
 */
public class AgencyTreeVO implements Serializable {
    private static final long serialVersionUID = 1L;

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

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

    /**
     * 节点层级
     */
    private String value;

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

    public AgencyTreeVO() {

    }

    public AgencyTreeVO(AgencyVO agency) {
        this.id = agency.getId();
        this.label = agency.getAgencyName();
        this.value = agency.getValue();
        this.children = agency.getChildren().stream().map(AgencyTreeVO::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 String getValue() {
        return value;
    }

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

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

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