/*
 * 文 件 名:  TreeEntity
 * 版    权:  浩鲸云计算科技股份有限公司
 * 描    述:  <描述>
 * 修 改 人:  lvwenbin
 * 修改时间:  2024/7/24
 * 跟踪单号:  <跟踪单号>
 * 修改单号:  <修改单号>
 * 修改内容:  <修改内容>
 */
package com.ruoyi.ems.domain.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.ems.domain.Area;
import com.ruoyi.ems.domain.AreaBuilding;
import com.ruoyi.ems.domain.AreaBuildingZoning;
import com.ruoyi.ems.domain.EmsCls;
import com.ruoyi.ems.domain.common.AreaTier;

import java.util.List;

/**
 * <一句话功能简述>
 * <功能详细描述>
 *
 * @author lvwenbin
 * @version [版本号, 2024/7/24]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
public class TreeEntity {
    /**
     * 节点ID
     */
    private String id;

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

    private String tier;

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

    public TreeEntity() {

    }

    public TreeEntity(Area area) {
        this.id = area.getAreaCode();
        this.label = area.getAreaName();
        this.tier = AreaTier.Area.name();
    }

    public TreeEntity(AreaBuilding building) {
        this.id = building.getBldgCode();
        this.label = building.getBldgName();
        this.tier = AreaTier.Building.name();
    }

    public TreeEntity(AreaBuildingZoning buildingZoning) {
        this.id = buildingZoning.getZoningCode();
        this.label = buildingZoning.getZoningName();
        this.tier = AreaTier.Zoning.name();
    }

    public TreeEntity(EmsCls emsCls) {
        this.id = emsCls.getCode();
        this.label = emsCls.getName();
    }

    public String getId() {
        return id;
    }

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

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getTier() {
        return tier;
    }

    public void setTier(String tier) {
        this.tier = tier;
    }

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

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