package com.bocloud.ims.entity.resource;


import com.bocloud.common.utils.DateDeserializer;
import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Table("sangfor_server_log")
@Data
public class SangforServerLog extends GenericEntity{

    @PK(value = PKStrategy.AUTO)
    private Long id; // ID
    @Column("object_type")
    private String objectType;
    @Column("event_id")
    private Integer eventId;
    @Column("hostid")
    private String hostid;
    @Column("hostname")
    private String hostname;
    @Column("action_type")
    private Integer actionType;
    @Column("user")
    private String user;
    @Column("object_id")
    private String objectId;
    @Column("risk_level")
    private Integer riskLevel; // 0 紧急，1 警报，2 关键，3 错误，4 警告，5 通知，6 信息，7 调试
    @Column("process")
    private Integer process;
    @Column("host")
    private String host;
    @Column("vm")
    private String vm;
    @Column("alert_type")
    private String alertType; // 0 一般行为，1 异常行为，2违规行为，3 其他
    @Column("module_type")
    private Integer moduleType; //虚拟机资源池 0，存储资源池1，虚拟网络资源池 2，服务器硬件 3，备份与恢复 4，系统管理 5，其他 6（用于测试 等，同时也标识未知）
    @Column("type")
    private String type;
    @Column("object_name")
    private String objectName;
    @Column("start")
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date start;
    @Column("end")
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date end;
    @Column("vendor_id")
    private Long vendorId; // 云供应商Id
    @Column("server_id")
    private Long serverId; // 虚拟机id
    @Column("guuid")
    private String guuid;
//    @Column("reserved4")
//    private String reserved4;
//    @Column("log_id")
//    private String logId;
//    @Column("bcancel")
//    private Integer bcancel;
//    @Column("target")
//    private String target;
//    @Column("pid")
//    private String pid;
//    @Column("reserved3")
//    private String reserved3;
//    @Column("sysloged")
//    private Integer sysloged;
//    @Column("description")
//    private String description;
//    @Column("type_cn")
//    private String typeCn;
//    @Column("otype")
//    private String otype;
}
