package com.gxwebsoft.common.system.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;

/**
 * 插件扩展
 *
 * @author 科技小王子
 * @since 2023-05-18 11:57:37
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "Plug对象", description = "插件扩展")
@TableName("sys_plug")
public class Plug implements Serializable {
    private static final long serialVersionUID = 1L;
    public static final int TYPE_MENU = 0;  // 菜单类型
    public static final int TYPE_BTN = 1;  // 按钮类型

    @Schema(description = "插件id")
    @TableId(value = "plug_id", type = IdType.AUTO)
    private Integer plugId;

    @Schema(description = "菜单ID")
    private Integer menuId;

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

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

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

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

    @Schema(description = "类型, 0菜单, 1按钮")
    private Integer menuType;

    @Schema(description = "排序号")
    private Integer sortNumber;

    @Schema(description = "权限标识")
    private String authority;

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

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

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

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

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

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

    @Schema(description = "插件描述")
    private String comments;

    @Schema(description = "插件详情")
    private String content;

    @Schema(description = "评分")
    private BigDecimal score;

    @Schema(description = "插件价格")
    private BigDecimal price;

    @Schema(description = "浏览次数")
    private Integer clicks;

    @Schema(description = "安装次数")
    private Integer installs;

    @Schema(description = "关联应用ID")
    private Integer appId;

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

    @Schema(description = "状态")
    private Integer status;

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

    @Schema(description = "商户编码")
    private String merchantCode;

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

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

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

    @Schema(description = "角色权限树选中状态")
    @TableField(exist = false)
    private Boolean checked;

    @Schema(description = "租户名称")
    @TableField(exist = false)
    private String tenantName;

    @Schema(description = "企业名称")
    @TableField(exist = false)
    private String companyName;

    @Schema(description = "企业简称")
    @TableField(exist = false)
    private String shortName;

    @Schema(description = "企业域名")
    @TableField(exist = false)
    private String domain;
}
