package com.ruoyi.bst.vip.domain;

import java.math.BigDecimal;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.interfaces.LogBizParam;
import com.ruoyi.common.core.validate.ValidGroup;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 卡券对象 bst_vip
 *
 * @author ruoyi
 * @date 2025-05-23
 */
@Data
public class Vip extends BaseEntity implements LogBizParam
{
    private static final long serialVersionUID = 1L;

    private Long id;

    @Excel(name = "运营区ID")
    @ApiModelProperty("运营区ID")
    @NotNull(message = "运营区ID不能为空", groups = {ValidGroup.Create.class})
    private Long areaId;

    @Excel(name = "卡券名称")
    @ApiModelProperty("卡券名称")
    @NotBlank(message = "卡券名称不能为空", groups = {ValidGroup.Create.class})
    private String name;

    @Excel(name = "卡券类型", readConverterExp = "1=储值卡,2=抵扣卡,3=折扣卡")
    @ApiModelProperty("卡券类型")
    @NotBlank(message = "卡券类型不能为空", groups = {ValidGroup.Create.class})
    private String type;

    @Excel(name = "售价")
    @ApiModelProperty("售价")
    @NotNull(message = "售价不能为空", groups = {ValidGroup.Create.class})
    @Min(value = 0, message = "售价不能小于0")
    private BigDecimal price;

    @Excel(name = "优惠值")
    @ApiModelProperty("优惠值")
    @NotNull(message = "优惠值不能为空", groups = {ValidGroup.Create.class})
    @Min(value = 0, message = "优惠值不能小于0")
    private BigDecimal discountValue;

    @Excel(name = "有效期(天)")
    @ApiModelProperty("有效期(天)")
    @NotNull(message = "有效期不能为空", groups = {ValidGroup.Create.class})
    @Min(value = 0, message = "有效期不能小于0")
    private Integer validDays;

    @Excel(name = "状态", readConverterExp = "1=上架,2=下架")
    @ApiModelProperty("状态")
    @NotBlank(message = "状态不能为空", groups = {ValidGroup.Create.class})
    private String status;

    @Excel(name = "使用说明")
    @ApiModelProperty("使用说明")
    @Size(max = 500, message = "使用说明不能超过500个字符")
    private String description;

    @Excel(name = "是否开启使用限制")
    @ApiModelProperty("是否开启使用限制")
    @NotNull(message = "是否开启使用限制不能为空", groups = {ValidGroup.Create.class})
    private Boolean enableLimit;

    @Excel(name = "可用次数")
    @ApiModelProperty("可用次数")
    @NotNull(message = "可用次数不能为空", groups = {ValidGroup.Create.class})
    @Min(value = 0, message = "可用次数不能小于0")
    private Integer limitTotal;

    @Excel(name = "限制频率次数")
    @ApiModelProperty("限制频率次数")
    @Min(value = 0, message = "限制频率次数不能小于0")
    private Integer limitCount;

    @Excel(name = "限制频率周期")
    @ApiModelProperty("限制频率周期")
    @Min(value = 0, message = "限制频率周期不能小于0")
    private Integer limitRound;

    @Excel(name = "限制频率单位", readConverterExp = "1=天")
    @ApiModelProperty("限制频率单位")
    @NotBlank(message = "限制频率单位不允许为空")
    private String limitUnit;

    @Excel(name = "创建人ID")
    @ApiModelProperty("创建人ID") 
    private Long createUserId;

    @Excel(name = "排序")
    @ApiModelProperty("排序")
    private Integer sort;

    @Excel(name = "最低使用门槛(元)")
    @ApiModelProperty("最低使用门槛(元)")
    @Min(value = 0, message = "最低使用门槛不能小于0")
    private BigDecimal minAmount;

    @Override
    public Object logBizId() {
        return id;
    }

}
