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.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.bocloud.ims.entity.resource.azure.account.StorageAccount;
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;
import java.util.List;

/**
 * container实体类
 *
 * @author wangyu
 * @version 5.0.0-SNAPSHOT
 * @since 2021/2/1
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table("container")
public class Container extends GenericEntity {

    @PK(PKStrategy.AUTO)
    private Long id;
    @Column("etag")
    private String etag;
    @Column("has_immutability_policy")
    private Boolean hasImmutabilityPolicy;
    @Column("has_legal_hold")
    private Boolean hasLegalHold;
    @Column("last_modified")
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastModified;
    @Column("lease_status")
    private String leaseStatus;
    @Column("lease_state")
    private String leaseState;
    @Column("lease_duration")
    private String leaseDuration;
    @Column("public_access")
    private String publicAccess;
    @Column("metadata")
    private String metadata;
    @Column("url")
    private String url;
    @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("storage_account_id")
    private Long storageAccountId;
    @Column("locked")
    private Boolean locked;
    @IgnoreAll
    private String vendorName;
    @IgnoreAll
    private String userName;
    @IgnoreAll
    private String projectName;
    @IgnoreAll
    private String tenantName;
    @IgnoreAll
    private String storageAccountName;
    @IgnoreAll
    private List<Blob> blobs;
    @IgnoreAll
    private List<Blob> snapshots;
    @IgnoreAll
    private StorageAccount storageAccount;
}
