package org.springblade.manager.vo;


import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.manager.entity.WbsTreePrivate;

import java.util.ArrayList;
import java.util.List;


/**
 * 视图实体类
 *
 * @author liuyc
 * @since 2022-05-24
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class WbsTreePrivateVO extends WbsTreePrivate implements INode<WbsTreePrivateVO> {
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 父节点ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;

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

    /**
     * 是否有子孙节点
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Boolean hasChildren;

    @Override
    public List<WbsTreePrivateVO> getChildren() {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        return this.children;
    }

    /**
     * 项目名称
     */
    private String projectName;


}
