package com.izouma.jmrh.domain;

import lombok.Data;
import org.hibernate.annotations.Where;

import javax.persistence.Entity;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@Entity
@Where(clause = "active = 1")
public class DataCenterMenu extends BaseEntity implements Serializable,Comparable {
    private String name;

    private String path;

    private String icon;

    private Integer sort;

    private Long parent;

    private Boolean root;

    private Boolean enabled;

    private Boolean active;

    private String category;
    @Transient
    List<DataCenterMenu> children =new ArrayList<>();

    @Override
    public int compareTo(Object o) {
        DataCenterMenu menu = (DataCenterMenu) o;
        return this.getSort().compareTo(menu.getSort());
    }
}
