package com.izouma.zhirongip.domain;

import com.izouma.zhirongip.enums.NavAuth;
import com.izouma.zhirongip.enums.NavType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Where;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
@ApiModel("导航条")
@Where(clause = "del = 0")
public class Navigation extends BaseEntity {
    private String name;

    private String path;

    private Integer sort;

    private Long parent;

    /*
    首页导航/页面中3个导航
     */
    @ApiModelProperty(value = "导航类别")
    @Enumerated(EnumType.STRING)
    private NavType type;

    @ApiModelProperty(value = "查看权限")
    @Enumerated(EnumType.STRING)
    private NavAuth navAuth;

    @Transient
    private List<Navigation> children = new ArrayList<>();
}
