package com.izouma.dingdong.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;

@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
//@JsonIgnoreProperties(value = { "hibernateLazyInitializer"})
//@Where(clause = "enabled = 1")
@ApiModel(value = "优惠券", description = "优惠券")
public class Coupon extends BaseEntity implements Serializable {

    @ApiModelProperty(value = "优惠券名称", name = "name")
    private String name;

    @ApiModelProperty(value = "金额", name = "amount")
    private BigDecimal amount;

    private LocalDate startDate;

    private LocalDate endDate;

/*    @ApiModelProperty(value = "使用规则", name = "rule")
    private String rule;*/

//    @Enumerated(EnumType.STRING)
//    @ApiModelProperty(value = "优惠券类型", name = "type")
//    private CouponType type;

    @ApiModelProperty(value = "满额", name = "fullAmount")
    private BigDecimal fullAmount;

    //商家发的优惠券
    private Long merchantId;

    //优惠券描述
    private String description;

    //用于限制优惠券类别
//    @ApiModelProperty(value = "类别Id")
//    @Convert(converter = LongArrayConverter.class)
//    private Set<Long> categoryIds = new HashSet<>();

//    @ApiModelProperty(value = "是否过期", name = "isExpired")
//    private Boolean isExpired;

    @Column(nullable = false)
    private Boolean enabled = true;
}
