package com.bocloud.ims.entity.resource.azure.blob;

import com.bocloud.common.utils.DateDeserializer;
import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.*;
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.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * azure blob对象存储
 *
 * @author wangyu
 * @version 5.0.0-SNAPSHOT
 * @since 2021/2/1
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table("azure_blob")
public class Blob extends GenericEntity {

    @PK(PKStrategy.AUTO)
    private Long id;
    @Column("copy_state")
    private String copyState;
    @Column("metadata")
    private String metadata;
    @Column("snapshot_id")
    private String snapshotID;
    @Column("snapshot_qualified_storage_uri")
    private String snapshotQualifiedStorageUri;
    @Column("stream_minimum_read_size_in_bytes")
    private Integer streamMinimumReadSizeInBytes;
    @Column("stream_write_size_in_bytes")
    private Integer streamWriteSizeInBytes;
    @Column("blob_type")
    private String blobType;
    @Column("content_type")
    private String contentType;
    @Column("append_blob_committed_block_count")
    private Integer appendBlobCommittedBlockCount;
    @Column("cache_control")
    private String cacheControl;
    @Column("content_disposition")
    private String contentDisposition;
    @Column("content_encoding")
    private String contentEncoding;
    @Column("content_language")
    private String contentLanguage;
    @Column("content_md5")
    private String contentMD5;
    @IgnoreUpdate
    @Column("created_time")
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createdTime;
    @Column("last_modified")
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastModified;
    @Column("etag")
    private String etag;
    @Column("lease_status")
    private String leaseStatus;
    @Column("lease_state")
    private String leaseState;
    @Column("lease_duration")
    private String leaseDuration;
    @Column("url")
    private String url;
    @Column("length")
    private Long length;
    @Column("page_blob_sequence_number")
    private Long pageBlobSequenceNumber;
    @Column("server_encrypted")
    private Boolean serverEncrypted;
    @Column("incremental_copy")
    private Boolean incrementalCopy;
    @Column("premium_page_blob_tier")
    private String premiumPageBlobTier;
    @Column("standard_blob_tier")
    private String standardBlobTier;
    @Column("blob_tier_inferred_tier")
    private Boolean blobTierInferredTier;
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column("tier_change_time")
    private Date tierChangeTime;
    @Column("rehydration_status")
    private String rehydrationStatus;
    @IgnoreUpdate
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column("deleted_time")
    private Date deletedTime;
    @Column("remaining_retention_days")
    private Integer remainingRetentionDays;
    @Column("is_snapshot")
    private Boolean snapshot;
    @Column("stream_write_size_modified")
    private Boolean streamWriteSizeModified;
    @Column("vendor_id")
    private Long vendorId;
    @Column("user_id")
    private Long userId;
    @Column("project_id")
    private Long projectId;
    @Column("tenant_id")
    private Long tenantId;
    @Column("container_id")
    private Long containerId;
    @Column("locked")
    private Boolean locked;
    @IgnoreAll
    private String vendorName;
    @IgnoreAll
    private String userName;
    @IgnoreAll
    private String projectName;
    @IgnoreAll
    private String tenantName;
    @IgnoreAll
    private String containerName;
}
