package com.izouma.nineth.domain;

import com.izouma.nineth.enums.AirDropType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

/**
 * 活动收集兑换藏品类
 *
 * @author ZouYuHong
 */
@Getter
@Setter
@Entity
@Builder
@AllArgsConstructor
public class AwardActivityCollectionInfo extends BaseEntity {
    /**
     *AirDropType为asset时为藏品id 为surprise_box时为惊喜盒子id
     */
    private Long collectionId;
    /**
     * 名称
     */
    private String collectionName;
    /**
     * 上架数量
     */
    private Integer num;
    /**
     * 余量
     */
    private Integer stock;
    /**
     * 图片地址
     */
    @Transient
    private String imgUrl;
    /**
     * 活动ID
     */
    @Column(name ="activity_id", insertable = false, updatable = false)
    private Long activityId;

    /**
     * 获得数量
     */
    @Column(nullable=false,columnDefinition="int default 1")
    private Integer exchangeNum;

    /**
     * 藏品类型
     */
    @Enumerated(EnumType.STRING)
    @Column(nullable=false,columnDefinition="varchar(255) default 'asset' ")
    private AirDropType airDropType;

    public AwardActivityCollectionInfo() {
        this.stock = num;
    }
}
