package com.izouma.nineth.domain;

import com.izouma.nineth.annotations.Searchable;
import com.izouma.nineth.converter.LongArrayConverter;
import com.izouma.nineth.enums.ItemType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.List;


@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(indexes = {
        @Index(columnList = "userId"),
        @Index(columnList = "ItemName"),
        @Index(columnList = "ItemId"),
        @Index(columnList = "assetId")
})
@Builder
@Entity
@ApiModel("仓库中的物品")
public class UserWareHouse extends BaseEntity {
    @ApiModelProperty("用户ID")
    private  Long userId;

    @ApiModelProperty("物品名字")
    @Enumerated(EnumType.STRING)
    private ItemType itemName;

    @ApiModelProperty("物品id")
    private Integer itemId;

    @ApiModelProperty("物品介绍")
    private String text;

    @ApiModelProperty("活动名字")
    private String name;

    @ApiModelProperty("是否有效")
    private boolean disabled;

    @ApiModelProperty("绑定的资产ID，如果该资产转移凭证跟着转移")
    @Searchable
    private Long assetId;

    @ApiModelProperty("第九空间/cosmos")
    private int projectId;

    @ApiModelProperty("（惊喜盒子配置ID）")
    private Long targetCollectionId;

    @Column(columnDefinition = "TEXT")
    @Convert(converter = LongArrayConverter.class)
    @ApiModelProperty("优先购指定关联藏品/盲盒ID")
    private List<Long> targetCollectionIdList;

    @ApiModelProperty("提前购买时间（小时）")
    private int advancePurchaseTime;

    @ApiModelProperty("可提前购买次数")
    private int advancePurchaseCount;

    @ApiModelProperty("电话号码")
    private String phone;

    @ApiModelProperty("优先购配置ID")
    private Long activityPriorityDocumentId;

    @ApiModelProperty("铸造者ID")
    private Long minterId;

    @ApiModelProperty("过期时间")
    private LocalDateTime overdueTime;

    /**
     * 白名单ID
     */
    private Long whitelistConfigId;
}