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.IgnoreAll;
import com.bocloud.entity.annotations.IgnoreInsert;
import com.bocloud.entity.annotations.IgnoreUpdate;
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.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 机柜类
 *
 * @author wei wei
 * @version 1.0
 * @since 2016.02.26
 */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Table("rack")
public class Rack extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id; // ID
	@Column("specs")
	private String specs; // 规格{长，宽，高}
	@Column("vendor")
	private String vendor; // 供应商
	@Column("product_date")
	@JsonSerialize(using = DateSerializer.class)
	@JsonDeserialize(using = DateDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date productDate; // 生产日期
	@Column("product_sn")
	private String productSn; // 出厂编号
	@Column("warranty")
	private String warranty; // 质保期
	@Column("type")
	private String type; // 类型{控制台机柜，标准机柜、网络机柜}
	@IgnoreInsert
	@IgnoreUpdate
	private String typeName; // 类型名称
	@Column("slot_amount")
	private Integer slotAmount; // 卡槽数量
	@Column("material")
	private String material; // 机柜材质
	@IgnoreInsert
	@IgnoreUpdate
	private String materialName; // 材质名称
	@Column("room_id")
	private Long roomId; // 机房ID
	@IgnoreInsert
	@IgnoreUpdate
	private String roomname; // 机房名称
	@Column("unit")
	private Integer unit; // U数
	@Column("axis_x")
	private Integer axisX; // 第几行
	@Column("axis_y")
	private Integer axisY; // 第几列
	@Column("config")
	private String config; // 3D配置
	@IgnoreInsert
	@IgnoreUpdate
	private Long dcId; // 数据中心ID
	@IgnoreInsert
	@IgnoreUpdate
	private String dcname; // 数据中心名称
	@IgnoreInsert
	@IgnoreUpdate
	private Integer racks; // 机柜数量
	@IgnoreInsert
	@IgnoreUpdate
	private Integer servers; // 服务器数量
	@IgnoreAll
	private Integer alarms; // 告警数量
	@IgnoreAll
	private Long cmdbId;// cmdb对应主键ID
	@IgnoreAll
	private BigDecimal usage;// 机柜使用率

}
