package com.yuchen.saas.manage.system.api.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nest.springwrap.core.tool.utils.Func;

import java.io.Serializable;
import java.util.Date;


@Data
@TableName("nest_menu")
@ApiModel(value = "Menu对象", description = "Menu对象")
public class Menu implements Serializable {

    private static final long serialVersionUID = 1L;


    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;


    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "菜单父主键")
    private Long parentId;


    @ApiModelProperty(value = "菜单编号")
    private String code;


    @ApiModelProperty(value = "菜单名称")
    private String name;


    @ApiModelProperty(value = "菜单别名")
    private String alias;


    @ApiModelProperty(value = "请求地址")
    private String path;


    @ApiModelProperty(value = "菜单资源")
    private String source;


    @ApiModelProperty(value = "排序")
    private Integer sort;


    @ApiModelProperty(value = "菜单类型")
    private Integer category;


    @ApiModelProperty(value = "操作按钮类型")
    private Integer action;


    @ApiModelProperty(value = "是否打开新页面")
    private Integer isOpen;


    @ApiModelProperty(value = "备注")
    private String remark;

    @TableLogic
    @ApiModelProperty(value = "是否已删除")
    private Integer isDeleted;

    @ApiModelProperty(value = "应用类型(详见数据字典)")
    private Integer applyType;

    @ApiModelProperty(value = "应用id")
    private Long applyId;

    @ApiModelProperty(value = "绑定功能Id")
    private Long featureId;

    @ApiModelProperty(value = "绑定功能父子级")
    private String featureIds;

    @ApiModelProperty(value = "菜单显示类型 1：默认显示全部，2：有权限才显示")
    private Integer menuType;
    @ApiModelProperty(value = "是否隐藏 0：否，1：是")
    private Integer hiddenFlag;
    @ApiModelProperty(value = "功能类型 1:业务功能;2:通用功能;3:默认功能;4:平台管理;")
    private Integer featureType;
    /**
     * @see org.nest.springwrap.core.secure.enums.IdEntityEnum
     */
    @ApiModelProperty(name = "idEntity", value = "身份（admin：管理员，clerk：员工，operation：运营端")
    private String idEntity;
    @ApiModelProperty(value = "菜单说明")
    private String explainInfo;

    @ApiModelProperty(value = "是否有效（0：否1 :是）")
    @TableField(exist = false)
    private Integer  ifExpire;
    @ApiModelProperty(value = "是否默认（0：否1 :是）")
    @TableField(exist = false)

    private Integer  ifDefault;
    @TableField(exist = false)
    @ApiModelProperty(value = "有有效期")
    private Date expireDate;
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        Menu other = (Menu) obj;
        if (Func.equals(this.getId(), other.getId())) {
            return true;
        }
        return false;
    }

}
