package com.gxwebsoft.cms.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import java.util.List;

import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 网站导航记录表
 *
 * @author 科技小王子
 * @since 2024-09-10 20:47:57
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "CmsNavigation对象", description = "网站导航记录表")
public class CmsNavigation implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "ID")
    @TableId(value = "navigation_id", type = IdType.AUTO)
    private Integer navigationId;

    @Schema(description = "类型, 0列表 1图文")
    private Integer type;

    @Schema(description = "菜单名称")
    private String title;

    @Schema(description = "上级id, 0是顶级")
    private Integer parentId;

    @Schema(description = "模型")
    private String model;

    @Schema(description = "模型名称")
    @TableField(exist = false)
    private String modelName;

    @Schema(description = "标识")
    private String code;

    @Schema(description = "菜单路由地址")
    private String path;

    @Schema(description = "菜单组件地址, 目录可为空")
    private String component;

    @Schema(description = "文件后缀")
    @TableField(exist = false)
    private String suffix;

    @Schema(description = "打开位置")
    private String target;

    @Schema(description = "菜单图标")
    private String icon;

    @Schema(description = "banner")
    @TableField(exist = false)
    private String banner;

    @Schema(description = "移动端banner")
    @TableField(exist = false)
    private String mpBanner;

    @Schema(description = "图标颜色")
    private String color;

    @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)")
    private Integer hide;

    @Schema(description = "可见类型 0所有人 1登录可见 2密码可见")
    private Integer permission;

    @Schema(description = "访问密码")
    private String password;

    @Schema(description = "验证密码(前端回传)")
    @TableField(exist = false)
    private String password2;

    @Schema(description = "位置 0不限 1顶部 2底部")
    private Integer position;

    @Schema(description = "仅在顶部显示")
    private Integer top;

    @Schema(description = "仅在底部显示")
    private Integer bottom;

    @Schema(description = "菜单侧栏选中的path")
    private String active;

    @Schema(description = "其它路由元信息")
    private String meta;

    @Schema(description = "css样式")
    private String style;

    @Schema(description = "父级栏目路由")
    private String parentPath;

    @Schema(description = "父级栏目名称")
    private String parentName;

    @Schema(description = "父级栏目位置")
    @TableField(exist = false)
    private Integer parentPosition;

    @Schema(description = "绑定的页面（已废弃）")
    private Integer pageId;

    @Schema(description = "详情页ID")
    private Integer itemId;

    @Schema(description = "是否微信小程序菜单")
    private Boolean isMpWeixin;

    @Schema(description = "菜单间距")
    private Integer gutter;

    @Schema(description = "菜单宽度")
    private Integer span;

    @Schema(description = "阅读量")
    private Integer readNum;

    @Schema(description = "用户ID")
    private Integer userId;

    @Schema(description = "商户ID")
    private Long merchantId;

    @Schema(description = "国际化语言")
    private String lang;

    @Schema(description = "用于同步翻译内容")
    private Integer langCategoryId;

    @Schema(description = "设为首页")
    private Integer home;

    @Schema(description = "是否推荐")
    private Boolean recommend;

    @Schema(description = "排序(数字越小越靠前)")
    private Integer sortNumber;

    @Schema(description = "备注")
    private String comments;

    @Schema(description = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @Schema(description = "状态, 0正常, 1冻结")
    private Integer status;

    @Schema(description = "租户id")
    private Integer tenantId;

    @Schema(description = "创建时间")
    @JsonIgnore  // 导航的创建时间前端不需要
    private LocalDateTime createTime;


    @Schema(description = "页面名称")
    @TableField(exist = false)
    private String pageName;

    @Schema(description = "子菜单")
    @TableField(exist = false)
    private List<CmsNavigation> children;

    @Schema(description = "页面布局")
    @TableField(exist = false)
    private String layout;

    @Schema(description = "关联的页面")
    @TableField(exist = false)
    private CmsDesign design;

    @Schema(description = "所属模型")
    @TableField(exist = false)
    private CmsModel modelInfo;

    @Schema(description = "父级栏目")
    @TableField(exist = false)
    private CmsNavigation parent;

    @Schema(description = "当前栏目名称")
    @TableField(exist = false)
    private String categoryName;

    @Schema(description = "当前栏目链接")
    @TableField(exist = false)
    private String categoryPath;

    @Schema(description = "栏目图片")
    @TableField(exist = false)
    private String photo;

    @Schema(description = "是否开启布局")
    @TableField(exist = false)
    private Boolean showLayout;

    @Schema(description = "单页内容")
    @TableField(exist = false)
    private String content;

    @Schema(description = "是否显示banner")
    @TableField(exist = false)
    private Boolean showBanner;

    @Schema(description = "菜单标题")
    @TableField(exist = false)
    private String text;

    @Schema(description = "栏目文章")
    @TableField(exist = false)
    private List<CmsArticle> articles;

    public String getCategoryName() {
      return this.title;
    }

    public String getCategoryPath() {
      return this.path;
    }

    public String getText() {
      return this.title;
    }

}
