package com.xinelu.manage.vo.labelfieldinfo;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

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

/**
 * 画像树图信息对象vo
 *
 * @author zh
 * @date 2024-06-27
 */
@Data
public class LabelFieldTreeVO implements Serializable {
    private static final long serialVersionUID = 1L;

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

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

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


    private String termCode;


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

    public LabelFieldTreeVO() {

    }

    public LabelFieldTreeVO(LabelFieldVO labelField) {
        this.id = labelField.getId();
        this.label = labelField.getLabel();
        this.termCode = labelField.getFieldCode();
        this.value = labelField.getCode();
        this.children = labelField.getLabelFieldList().stream().map(LabelFieldTreeVO::new).collect(Collectors.toList());
    }

    public Long getId() {
        return id;
    }

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

    public String getTermCode() {
        return termCode;
    }

    public void setTermCode(String termCode) {
        this.termCode = termCode;
    }

    public Integer getValue() {
        return value;
    }

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

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

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