package com.bocloud.ims.entity.topology;

import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.Generic;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Instance实体类
 *
 * @author lyy
 * @Version 1.0
 * @since 2017年9月15日
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table("ci_instance")
public class Instance extends Generic {
    @PK(value = PKStrategy.AUTO)
    private Long id;
    @Column("b_name")
    private String bname;
    @Column("is_deleted")
    private Boolean deleted;
    @Column("auditflag")
    private Boolean auditflag;
    @Column("module_id")
    private Long moduleId;
    @Column("uuid")
    private String uuid;
    // 创建时间
    @Column("gmt_create")
    @JsonSerialize(using = DateSerializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtCreate;
    // 修改时间
    @Column("gmt_modify")
    @JsonSerialize(using = DateSerializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtModify;
    // 创建人
    @Column("creator_id")
    private Long creatorId;
    // 修改人
    @Column("mender_id")
    private Long menderId;
    @IgnoreAll
    private List<InstanceValue> properties;
    // 图标
    @IgnoreAll
    private Long iconId;
    // 通过target_id查询的Module数据
    @IgnoreAll
    private List<Map<String, Object>> nodes;
    // 查询的模型关系
    @IgnoreAll
    private List<Map<String, Object>> links;
    // 模型编码
    @IgnoreAll
    private String moduleCode;
    // mq穿过来的操作命令 支持 delete modify（局部更新）
    @IgnoreAll
    private String operation;
    @IgnoreAll
    // mq接收关系用
    private List<InstanceRelationMq> relations;
    // 是否有告警
    @IgnoreAll
    private Boolean haveAlarm;

    @IgnoreAll
    private Map<Long, String> relationIconMap;

}
