package com.bocloud.ims.entity.resource;

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

import org.springframework.format.annotation.DateTimeFormat;

import com.alibaba.fastjson.JSONObject;
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.GenericEntity;
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;

/**
 * 备份
 * 
 * @author admin
 *
 */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Table("backup")
public class Backup extends GenericEntity {

	@PK(PKStrategy.AUTO)
	private Long id;// ID

	@Column("region_id")
	private String regionId;// 所属域

	@Column("vendor_id")
	private Long vendorId;// 所属云平台

	@Column("backup_uuid")
	private String backupUuid;

	@Column("snapshot_uuid")
	private String snapshotUuid;

	@Column("vaults_uuid")
	private String vaultsUuid;

	@Column("create_time")
	@JsonSerialize(using = DateSerializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;

	@Column("resource_uuid")
	private String resourceUuid;

	@Column("bootable")
	private Boolean bootable;

	@Column("resource_name")
	private String resourceName;

	@Column("resource_az")
	private String resourceAz;

	@Column("image_type")
	private String imageType;

	@Column("checkpoint_uuid")
	private String checkpointUuid;

	@Column("resource_type")
	private String resourceType;

	@Column("resource_size")
	private Integer resourceSize;

	@Column("extend_info")
	private String extendInfo;

	@Column("parent_resource_uuid")
	private String parentResourceUuid;

	@Column("tenant_id")
	private Long tenantId;// 租户ID
	@Column("project_id")
	private Long projectId;// 项目ID

	@IgnoreAll
	private String regionName;
	@IgnoreAll
	private String tenantName;
	@IgnoreAll
	private String projectName;
	@IgnoreAll
	private String vendorType;
	@IgnoreAll
	private String vendorName;
	@IgnoreAll
	private String vaultsName;
	@IgnoreAll
	private List<JSONObject> subBackups;
}
