package com.dayou.bo;

import lombok.Data;

import java.util.List;

@Data
public class PrivilegeTreeBO implements Tree<Long,String>{

    /**
     * id
     */
    private Long id;

    /**
     * 父id
     */
    private Long parentId;
    /**
     * 类型 菜单/按钮
     * @see com.dayou.enums.MenuTypeEnum
     */
    private String menuType;
    /**
     * 名称
     */
    private String name;

    private List<PrivilegeTreeBO> children;

    /**
     * 是否选中
     */
    private Boolean checked = false;

    /**
     * 菜单编号
     */
    private String menuNo;

    /**
     * 菜单code
     */
    private String menuCode;

    /**
     * pc端url
     */
    private String pcUrl;
    /**
     * pc端图标
     */
    private String pcIcon;


    private Boolean cachedViews;

    private int orderNum;

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public Long getParentId() {
        return parentId;
    }

    @Override
    public int order() {
        return orderNum;
    }

    @Override
    public List<? extends Tree<Long, String>> getChildren() {
        return children;
    }

    @Override
    public void setChildren(List<? extends Tree<Long, String>> children) {
        this.children = (List<PrivilegeTreeBO>) children;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        PrivilegeTreeBO that = (PrivilegeTreeBO) o;

        return id != null ? id.equals(that.id) : that.id == null;
    }

    @Override
    public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }
}
