package com.izouma.nineth.domain;

import com.izouma.nineth.converter.LongArrayConverter;
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.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel("兑换券")
public class UserCoupon extends BaseEntity {

    private Long userId;

    private Long couponId;

    @ApiModelProperty("名称")
    private String name;

    @ApiModelProperty("备注")
    private String remark;

    @ApiModelProperty("是否指定藏品可用")
    private boolean limited;

    @ApiModelProperty("需要支付GAS")
    private boolean needGas;

    @Convert(converter = LongArrayConverter.class)
    @Column(columnDefinition = "TEXT")
    @ApiModelProperty("可用藏品ID")
    private List<Long> collectionIds;

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

    @ApiModelProperty("是否已使用")
    private boolean used;

    @ApiModelProperty("使用时间")
    private LocalDateTime useTime;

}
