package com.izouma.nineth.domain;

import com.izouma.nineth.dto.CollectionInfoDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

@Data
@Entity
@Table(name = "collection_privilege", indexes = {
        @Index(columnList = "collectionId")
})
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel("藏品")
public class CollectionPrivilege extends BaseEntity {
    private Long collectionId;

    @ApiModelProperty("展厅头部背景")
    private String headBg;

    @ApiModelProperty("展厅背景")
    private String showroomBg;

    @ApiModelProperty("最多可放藏品数量")
    private Integer maxCollection;

    @Column(columnDefinition = "bit default false")
    @ApiModelProperty("vip特权")
    private boolean vip;

    @ApiModelProperty("企业藏品")
    private Long companyCollectionId;

    public CollectionPrivilege(CollectionInfoDTO info, Long collectionId) {
        BeanUtils.copyProperties(info, this);
        this.collectionId = collectionId;
    }
}
