package com.yuchen.saas.parking.api.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.nest.springwrap.core.tool.node.INode;

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

/**
 * @author 王勇
 * @version 1.0
 * @date 2021/5/26 14:04
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ParkParkingTreeVO extends PmgBatParkParkingVO implements INode<ParkParkingTreeVO> {
    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;

    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<ParkParkingTreeVO> children;

    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Boolean hasChildren;

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


}
