package com.fzm.mall.server.admin.system.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fzm.mall.server.admin.util.UUIDUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * <p>
 * 系统中心-区块链管理
 * </p>
 *
 * @author fzm
 * @since 2021-08-12
 */
@Data
@TableName("sys_block_chain_management")
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "SysBlockChainManagement对象", description = "系统中心-区块链管理")
public class SysBlockChainManagement implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 是否可用(0--已被删除 1--正常 2->停用)
     */
    public static final Integer STATUS_DELETED = 0;

    public static final Integer STATUS_EFFECTIVE = 1;

    public static final Integer STATUS_DISABLED = 2;

    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "区块链编号")
    private String blockChainId;

    @ApiModelProperty(value = "区块链名称")
    private String blockChainName;

    @ApiModelProperty(value = "是否可用(0--已被删除 1--正常 2->停用)")
    private Integer status;

    @ApiModelProperty(value = "区块链rpc请求ip")
    private String ip;

    @ApiModelProperty(value = "区块链rpc请求端口")
    private String port;

    @ApiModelProperty(value = "标题")
    private String title;

    @ApiModelProperty(value = "初始区块高度")
    private Integer startHeight;

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

    @ApiModelProperty(value = "信息入库时间")
    @TableField(fill = FieldFill.INSERT)
    private Long createTime;

    @ApiModelProperty(value = "信息修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateTime;

    public void init() {
        setBlockChainId(UUIDUtil.getUUID());
        setStatus(STATUS_EFFECTIVE);
    }
}
