package com.bocloud.ims.entity.resource.contentlibrary;

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

/**
 * 内容库
 *
 * @author wangyu
 * @version 5.0.0-SNAPSHOT
 * @since 2021/2/26
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table("content_library")
public class ContentLibrary extends GenericEntity {

    @PK(PKStrategy.AUTO)
    private Long id;
    @Column("library_uuid")
    private String libraryUuid;
    @Column("version")
    private String version;
    @Column("storage_backings")
    private String storageBackings;
    @Column("type")
    private String type;
    @Column("server_guid")
    private String serverGuid;
    @Column("publish_info")
    private String publishInfo;
    @Column(value = "creation_time", nullable = false)
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date creationTime;
    @Column(value = "last_modified_time", nullable = false)
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastModifiedTime;
    @Column("vendor_id")
    private Long vendorId;
    @Column("project_id")
    private Long projectId;
    @Column("tenant_id")
    private Long tenantId;
    @IgnoreAll
    private String projectName;
    @IgnoreAll
    private String tenantName;
}
