package shop.alien.entity.store;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;

/**
 * <p>
 * 优惠券用户表
 * </p>
 *
 * @author ssk
 * @since 2025-02-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "LifeDiscountCouponUser对象", description = "优惠券用户表")
public class LifeDiscountCouponUser extends Model<LifeDiscountCouponUser> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "用户id")
    @TableField("user_id")
    private Integer userId;

    @ApiModelProperty(value = "券id")
    @TableField("coupon_id")
    private Integer couponId;

    @ApiModelProperty(value = "领取时间")
    @TableField(value = "receive_time")
    private Date receiveTime;

    @ApiModelProperty(value = "到期时间（按领取日 + 券模板有效期天数计算；无天数时回退模板有效/结束日期）")
    @TableField(value = "expiration_time")
    private LocalDate expirationTime;

    @ApiModelProperty(value = "使用时间")
    @TableField(value = "use_time")
    private Date useTime;

    @ApiModelProperty(value = "优惠券状态（0：待使用，1：已使用，2：已作废）")
    @TableField("status")
    private Integer status;

    @ApiModelProperty(value = "删除状态")
    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @ApiModelProperty(value = "创建人ID")
    @TableField(value = "created_user_id", fill = FieldFill.INSERT)
    private Integer createdUserId;

    @ApiModelProperty(value = "修改人ID")
    @TableField(value = "updated_user_id", fill = FieldFill.INSERT_UPDATE)
    private Integer updatedUserId;

    @ApiModelProperty(value = "U币ID")
    @TableField("ub_id")
    private Integer ubId;

     @ApiModelProperty(value = "福利ID")
     @TableField("welfare_id")
     private Integer welfareId;

    /**
     * 代金券id（代金券时使用，对应 life_coupon.id）
     */
    @ApiModelProperty(value = "代金券id")
    @TableField("voucher_id")
    private String voucherId;

    @ApiModelProperty(value = "发放来源：1-手动领取，2-收藏店铺，3-好评送券，4-好友赠送，5-平台发放")
    @TableField("issue_source")
    private Integer issueSource;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
