package com.bocloud.ims.entity.resource;

import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

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.Data;

/**
 * 存储桶
 * 
 * @date 2021/09/08
 */
@Table("bucket")
@Data
public class Bucket extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id; // ID
	@Column("vendor_id")
	private Long vendorId; // 云供应商ID
	@IgnoreAll
	private String vendorName; // 云供应商名称
	@Column("region")
	private Long region; // 镜像所在区域
	@IgnoreAll
	private String regionName; // 镜像所在区域名称
	@Column("space")
	private Double space;// 空间
	@Column("location")
	private String location;// 位置
	@Column("acl")
	private Boolean acl;// 权限
	@Column("expired_time")
	@JsonSerialize(using = DateSerializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date expiredTime;// 过期时间

	@Column("create_time")
	@com.fasterxml.jackson.databind.annotation.JsonSerialize(using = com.bocloud.common.utils.DateSerializer.class)
	@com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = com.bocloud.common.utils.DateDeserializer.class)
	@org.springframework.format.annotation.DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;

	@Column("region_id")
	private String regionId;

	@Column("actual_name")
	private String actualName;
	@Column("tenant_id")
	private Long tenantId; // 租户ID
	@Column("user_id")
	private Long userId; // 对象用户ID
	@Column("traffics")
	private Long traffics; // 下载流量
	@Column("bucket_acl")
	private String bucketAcl;

	@Column("bucket_uuid")
	private Long bucketUuid;
	@Column("object_user_id")
	private Long objectUserId;
	@Column("object_user_uuid")
	private Long objectUserUuid;
	@Column("object_user_name")
	private String objectUserName;

	@Column("quota_max_objects")
	private Long quotaMaxObjects;
	@Column("quota_max_size")
	private Long quotaMaxSize;
	@Column("nfs_client_num")
	private Long nfsClientNum;
	@Column("owner_permission")
	private String ownerPermission;
	@Column("shards")
	private Long shards;
	@Column("allocated_objects")
	private Long allocatedObjects;
	@Column("allocated_size")
	private Long allocatedSize;

	@Column("is_worm")
	private Boolean worm; // 写保护
	@Column("is_versioned")
	private Boolean versioned; // 多版本

	@IgnoreAll
	private String spaceUsed;
	@IgnoreAll
	private int objectCount;
	@IgnoreAll
	private Boolean expired;
	@IgnoreAll
	private Long monthTraffic;

}
